Breyten Ernsting

When life imitates your Twitter Bio

About 1.5 years ago it was time to renew my mobile plan, and as a result I got a shiny new HTC Desire, instead of the iPhone 3g I was using in the two years before that. The result was that my iPhone was basically doing nothing. I jokingly said that it was now my alarm clock, which led to the line on my Twitter bio: “I’m so hip, I use my iPhone only as an alarm clock”.

Of course I sometimes used it for other things as well. However, a couple of months ago the home button broke down, which is quite a pain in the ass as the iPhone pretty much has only one button with which you can do anything useful (read: go to the home screen). As I can no longer go to the home screen and switch apps easily (Doing so would require a restart of the iPhone)), I must admit that my Twitter bio is now finally correct.

My Year in Cities, 2011

Like I did in 2008 and 2009:

  • Amsterdam* (I live here)
  • Eindhoven
  • Riga, Latvia*
  • Trakai, Lithuania
  • Manchester, England
  • Warsaw, Poland

Using separate tables in Rails with model inheritance

Suppose there is a situation where you have two separate tables with the exact same structure, and you want to use separate models in Rails. Obviously, you want shared functionality from the models (order, scopes etc.), so the most logical way to go about it seems to be:

class Vehicle < ActiveRecord::Base
end

class Car < Vehicle
end
The problem however, is that is triggers Single Table Inheritance, even when you don’t have a type column in your table. So, in the example above Rails will always use the vehicles table. Luckily, there is a way to override Rails’s method of inferring the table name from the class name. It works like this:
class Vehicle < ActiveRecord::Base
end

class Car < Vehicle
  set_table_name 'cars'
end
Now your models will behave as expected.

I salute the women who said, “Hey, wait a minute. Maybe having a vagina doesn’t determine what I have to want from life! Just because a lot of women want something, doesn’t mean that I have to want the exact same thing!

The idea is to write simple, yet machine parseable documentation such that you can automatically create a living styleguide

De shell toren: 

Taken with picplz.
De shell toren:

Taken with picplz.

Kryžių kalnas (Hill of Crosses)

Kryžių kalnas (Hill of Crosses)