Search_spinner Cross_grey Magnifier

Search syntax

  • Search for repeating cards with repeats:yes
  • Search for unfinished cards with unfinished:yes
  • Search for cards in a certain topic with topic:"name"
  • Search for phrases with "a phrase"
  • Exclude a word from search: -word
  • Exclude a phrase from search: -"a phrase"
  • Exclude a topic from search: -topic:"name"

Rails 3.1 error message: Could not find a JavaScript runtime

After starting the Rails server in a freshly generated Rails 3.1 project you could see an error message such as

/usr/lib/ruby/gems/1.8/gems/execjs-1.3.0/lib/execjs/runtimes.rb:50:in `autodetect': Could not find a JavaScript runtime. See for a list of available runtimes. (ExecJS::RuntimeUnavailable)

Just add a JavaScript runtime to your Gemfile and the error vanishes.


gem 'therubyracer'
gem 'extjs'

Change the MySQL default character set on Amazon Relational Database Service (RDS)

Look here for informations how you can show the MySQL default character set.

At first you need the Amazon RDS Command Line Toolkit

  • download and unzip the [Amazon RDS Command Line Toolkit](…

Make Type 1 fonts (.pfb/.pfm) appear in OpenOffice on Ubuntu Linux

When you install Type 1 fonts (like makandra’s corporate typeface), they won’t show up in OpenOffice. OpenOffice requires some additional files to process them. Stefan Gründel found out what to do.

There is a tool that can produce the missing files:

sudo apt-get install t1lib-bin

Now you can create .afm files:

cd ~/.fonts
type1afm *.pfb

Restart OpenOffice and the fonts should show up.

Cucumber.yml was found, but could not be parsed.

If you encounter the error message above when running cucumber, just execute…
rm rerun.txt …in the Rails directory.

Or run…
tests …from the geordi gem. This will do the work for you automatically.

Solve screen error "Cannot open your terminal '/dev/pts/0' - please check"

When using the screen tool you may be unable to start a screen session but instead encounter an error:

Cannot open your terminal '/dev/pts/0' - please check.

This is because another user (you) initiated the current terminal – you probably did a sudo su into the user you are now trying to run screen as, right?

There are two ways to resolve this:

  • Sign out and properly connect / sign in as the user you wish to use.
  • Run script /dev/null to own the shell (more info over at [Server Fault](…

Git: How to create and apply patches

You can convert git commits into patch files. Those can be used to apply to a different repository [1] or by someone else (e.g. sent when sent to them via e-mail).

Creating a patch

  1. Make your changes and commit them.
  2. Run git format-patch COMMIT_REFERENCE to convert all commits since the referenced commit (not including it) into patch files.

For example, let’s say you prepared 2 commits. Run:

git format-patch HEAD~~ 

This will create 2 files, one for each commit since HEAD~~, like these:


Web font embedding requires new CSS for IE9

If you embedded web fonts in the past years (e.g. by copying CSS from a Font Squirrel @font-face kit), that CSS won’t work in Internet Explorer 9.

You can fix it by turning these styles…

  font-family: 'MyFont'
  src: url('myfont.eot')
  src: local("☺"), ('myfont.ttf') format("truetype")
  font-weight: normal
  font-style: normal

… into these:

  font-family: 'MyFont'
  src: url('myfont.eot')
  src: local("☺"), url('myfont.e...

Improve web font rendering in Windows by autohinting fonts

Web fonts are awesome. After being restricted to Arial for two decades there is finally a cross-browser way to embed fonts into web pages.

Unfortunately while web fonts look awesome on Linux and MacOS, they look horrible on Windows, a problem that gets worse with smaller font sizes.

The culprit is something called font hinting:

Give table columns equal width using CSS

If you want to distribute a <table>’s width equally over its columns, you can use the following CSS property:

table-layout: fixed

It is supported by every browser ever.

/proc/cpuinfo on Solaris

When used to do:

$> cat /proc/cpuinfo 
processor : 0 
vendor_id : GenuineIntel 
cpu family : 15 
model : 4 
model name : Intel(R) Xeon(TM) CPU 3.00GHz 
stepping : 1 
cpu MHz : 2992.785 

Instead, on Solaris, use psrinfo(1M)

$> psrinfo -v 
Status of virtual processor 0 as of: 09/17/2006 21:45:32 
on-line since 08/24/2006 16:16:03. 
The i386 processor operates at 1800 MHz, 
and has an i387 compatible floating point processor. 
Status of virtual processor 1 as of: 09/17/2006 21...

Show the character set and the collation of your MySQL tables

To show the collation of your tables you have to login to the MySQL console and execute SHOW TABLE STATUS FROM database;

| Name        | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_leng...

Stub a request's IP address in a Cucumber scenario

The solution in this card is based on a stack overflow post by Leventix.

If you need to make request come from a fixed IP address for the duration of a Cucumber scenario, the code below lets you write this:

Given my IP address is

Rails 3

Given /^my IP address is "(.*?)"$/ do |ip|

Rails 2 —–…

How the Clearance gem remembers and clears sessions

Clearance is a gem that provides authentication functionality (e.g. login, logout). This note explains, how the clearance login, logout and (in old Clearances) remember me functionality works.


Clearance defines a database column called “remember_token”. When you login in, that token will be saved in a cookie. For that reason you don’t have to re-sign-in when you close and open the browser again.
This also means that you can be logged in in more than a single browser. Also see [When ses…

Connect to a VirtualBox guest machine over the network

You must reconfigure the guest so it will get its own IP address:

  • Shutdown the guest
  • In the guest’s VirtualBox settings, choose Network and switch the network adapter type to Bridged
  • Restart the guest
  • Read the guest’s IP address from the output of ifconfig (Unix) or ipconfig (Windows)
  • You can now connect to this IP address using HTTP, SSH, etc.

Note that by doing this your VirtualBox guest is fully exposed on the local network, just like your host machine.

Micro clearfix mixin for Sass

Clearfix is a hack to clear floating elements without additional HTML markup.

Over the years many different clearfix methods have appeared. Currently Nicolas Gallagher’s Micro Clearfix Hack seems to be in vogue. It is known to work in Firefox 3.5+, Safari 4+, Chrome, Opera 9+, IE 6+.

This card describes a micro clearfix mixin for Sass. It let’s you say this:


Stub methods on any instance of a class in Rspec 1 and Rspec 2

RSpec 1 (Rails 2)

With the most recent spec_candy.rb helpers you can say:

User.stub_any_instance(:foo => :bar)
user =
# => :bar

RSpec 2 (Rails 3)

RSpec 2 comes with this feature built in:

User.any_instance.stub(:foo => :bar)
user =
# => :bar

Show and change MySQL default character set

To show the MySQL default character set you have to login to the MySQL console and execute SHOW VARIABLES LIKE 'char%';

mysql> SHOW VARIABLES LIKE  'char%';
| Variable_name            | Value                      |
| character_set_client     | latin1                     |
| character_set_connection | latin1                     |
| character_set_database   | latin1                     |
| chara...
External content

Ruby 2.0 Implementation Work Begins: What is Ruby 2.0 and What’s New?

While 2.0 will include a number of syntax changes, new features and general improvements, mentioned below, it is anticipated to remain backward compatible with code written for 1.9.3 and Matz has stated that the changes are less significant than those made in the 1.8 to 1.9 jump.

2787 cards