How to Refactor Code

Seems obvious, right? You just edit it until it works the way you want it to. Not so fast. Reckless code changes will turn your project into a big ball of mud before you know it. Done in the right way you'll experience less frustration and fewer crises.

While you may write code as a developer, your main task is not writing code: it's removing ambiguity and mitigating project risks.

If you're working on a personal project or in a ☞

A Gherkin styleguide

Few, if any websites make useful recommendations about how to phrase Gherkin steps, so allow me to make some suggestions in the hope they will make life simpler.

Given steps establish state

Given steps describe a current, present, extant state of the test environment (I use the term loosely) before some (to be tested) action is performed.

The fact that your Given step definition likely creates that state in code behind the scenes is irrelevant.

  • Given steps must be in ☞

The ultimate AeroPress technique

AeroPress!

Having made countless cups of AeroPress'd coffee (mostly at work), I've finally arrived at the perfect cuppa.

  1. Boil the jug. Yup, boil. You'll see why in a moment.
  2. Pour boiling water into your coffee cup. If you take milk in your coffee leave room for milk. Otherwise fill it up.
  3. Grind coffee / put ground coffee in an inverted AeroPress.
  4. Fill AeroPress with hot water from cup. Your cup is now hot and the water has cooled to the perfect temperature ☞

New project: CourseMonger.com

So! I have a new project underway, CourseMonger.com.

Unlike many solutions, this one started with a problem. My partner teaches parenting courses, each comprised of multiple workshops. Each workshop can be at a different price and vary in number of places available. Any prospective system would also need to provide a reservation system whereby a place is reserved for say, 8 minutes while a student completes her booking.

Eventbrite provides registration-locking, but the Eventbrite model is based on events ☞

How to create many-to-many relationships with associated properties in SQLAlchemy

I once had a scenario where one business could be managed by multiple users, and each user could manage multiple businesses. To further complicate matters, only one user could be the Administrator of a business, which should ideally also be represented by the relationship.

Finding out how to represent that relationship was tricky as I couldn't find it in the SQLAlchemy docs, and StackOverflow was a mixed bag. This is what I pieced together:

from datetime import datetime as dt ☞

What's your capacity to hustle?

This gem turned up in the Ribbonfarm post Stone-Soup for the Capitalist’s Soul:

  1. Your rights to your wealth do not extend beyond your understanding of it.
  2. You are fair game for hustlers who understand your wealth better than you do.
  3. The role of the state is to limit the violence with which you can be hustled.
  4. If you are poor you have the right to hustle the rich within certain limits.

It's a take on the old stone-soup fable ☞

Page 1 / 2 »