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"

How to fix Passenger "Unexpected end-of-file detected" error

This is for you if Passenger gives you the following useless error message.

Passenger encountered the following error:\
The application spawner server exited unexpectedly: Unexpected end-of-file detected.

Exception class:

Most often this happens because you are missing a gem. Usually Passenger would tell you about that but in some cases it can't.

To resolve this issue, run:

bundle install

If this does not do the trick for you, take a look at the Apache log files for de…

How to get the latest Thunderbird on older Ubuntus

My Ubuntu (11.04, and other/older versions) does not ship the latest Thunderbird but keeps patching 3.x.

If you want Thunderbird 11 (and following versions), you need to add the Mozilla Thunderbird PPA to your APT sources yourself:

sudo add-apt-repository ppa:mozillateam/thunderbird-stable

Afterwards, update your packages and install the new Thunderbird:

sudo apt-get update
sudo apt-get upgrade

If you were previously using [Lightning](…

Shell script to deploy changes to production and not shoot yourself in the foot

Geordi, our collection of command line tools, has been extended by another command deploy-to-production. This script encapsulates the following workflow:

  • Pull the production branch.
  • Show which commits from the master would make it to production with this deploy.
  • Ask if you want to proceed.
  • If yes, merge the master into the production branch, push and deploy with bundle exec cap production deploy:migrations

The script will ask you for the names of your master branch, production branch an…

Fix warning: Cucumber-rails required outside of env.rb

After installing Bundler 1.1 you will get the following warning when running tests:

WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being defered until env.rb is called.\
To avoid this warning, move 'gem cucumber-rails' under only group :test in your Gemfile

The warning is misleading because it has nothing to do with moving cucumber-rails into a :test group. Instead you need to change your Gemfile to say:

gem 'cucumber-rails', :require => false

Git: Push a new branch and track it immediately

When you create a new branch and push it to origin, you won't be tracking it. This means a git pull won't know its remote version.

You could use difficult commands to set up a branch's tracking but it's easier to just push it like this:

git push -u

From the documentation on git push:

-u, --set-upstream \
For every branch that is up to date or successfully pushed, add upstream (tracking) reference, used by argument-less git-pull(1) and other commands. For more information, see branch.<…

MySQL shell: Vertical vs horizontal layout

When talking to your MySQL server via a mysql shell, you can terminate queries by ; or \G – the latter gives you a vertical output.

You know this:

mysql> SELECT * FROM users;
| id | name    | email               | greeting        |
|  1 | Alice   |   | Hello world!    |
|  2 | Bob     |     | Hello universe! |
|  3 | Charlie | | Hi mom!    ...

Validate attachment presence using paperclip

Make sure you call the methods in the following order and not vice versa:

has_attached_file :image
validates_attachment_presence :image

Validation with condition works fine, too:

validates_attachment_presence :image, :if => :method

This is because validates_attachment_presence is only available after saying has_attached_file.

Building Gem 'RedCloth' with Bundler and GCC 4.6

If you cannot install the gem 'RedCloth' via bundle install you might want to try the following.

Specifying extra build options for bundler which will only be applied when building RedCloth:

bundle config build.RedCloth --with-cflags=-w

Move page breaks in LibreOffice Calc

  • You can define what will be printed by checking View -> Preview Page Breaks and then moving around the blue borders.
  • You can now define the size of the printed content under Format -> Page -> Sheet -> Scale. You can choose between three scaling modes which all suck in their own way.
External content

Todo.txt: Future-proof task tracking in a file you control

Solution to share a todo.txt file over Dropbox and make it editable on Android und iOS devices. Also comes with a CLI interface for common actions like adding a new task or listing all tasks pertaining to a GTD context.

Unfortunately it only supports flat todo lists, no nesting.

External content

Ruby blocks: Braces and do/end have different precedence

Braces and do/end are completely swappable—almost all the time. They have different precedence. It’s not often that anyone comes across what this means in practice.

Make your regular expressions more readable

The following two hints are taken from Github's Ruby style guide:

If your regular expression mentions a lot of forward slashes, you can use %r(...), %r[...] or %r{...} instead of /.../.


If your regular expression is growing complex, you can use the x modifier to ignore whitespace and comments:

regexp = %r{
  start         # some text
  \s            # white space char
  (group)       # first group    ...

LibreOffice Calc: How to paste cells without overwriting other cells

The default behavior of Calc is that when you paste cells from the clipboard, it overwrites whatever cells occupy the same space on the spreadsheet. If you would like to insert the cells in the clipboard instead by pushing the existing cells to the bottom or the right, you can do it like this:

  • Go to Edit / Paste Special
  • The paste dialog has a segment Shift Cells. Choose Down or Right depending on what you want to do.

Issue with an escaped "equals" sign in the development log email representation

An = is represented by =3D in the log file.

I got confused by the leading 3D which is not part of the token, you can see in the following example:

Hallo Max!

Danke f=C3=BCr deinen Beitrag. Bitte best=C3=A4tige deine Teilnahme, inde=
m du auf den folgenden Link klickst:


Viele Gr=C3=BC=C3=9Fe vom Team!

My token is actually only EA7BB9DA73FF17AO.

Run multiple Redis servers on Ubuntu

This is a way to run multiple redis server on one ubuntu server.

These steps you have to do only once:

  • Adjust init script

Change some Variables.
From this:


to this:

NAME=`basename ${0}`
  • Move redis configuration
mv /etc/redis/redis.conf /etc/redis/redis-server.conf

These steps y…

validates_acceptance_of is skipped when the attribute is nil

validates_acceptance_of :terms only works if terms is set to a value. The validation is skipped silently when terms is nil.

While this behavior is useful to validate acceptance in the frontend and not the admin backend, it also makes it very easy to unintentionally skip the validation altogether by forgetting to add the checkbox to a form. E.g. validates_acceptance_of :terms_with_typo will be skipped silently even if there is no column with t…

Define a route that only responds to a specific format

You won't usually have to do this. It's OK to route all formats to a controller, and let the controller decide to which format it wants to respond.

Should you for some reason want to define a route that only responds to a given format, here is how you do it:

Rails 3

match 'sitemap.xml' => 'feeds#sitemap', :constraints => { :format => 'xml' }, :as => 'sitemap'

Rails 2

map.sitemap 'sitemap.xml', :controller => 'feeds', :action => 'sitemap', :format => 'xml'
External content

Tabs in Textarea Plugin for jQuery

This is a demo of the "Tabby" Javascript jQuery plugin to use tabs in regular textareas to make them suitable for in-browser coding of languages like HTML, CSS, Javascript, or your favorite server-side language. The idea is to be able to use a press of the TAB button or SHIFT+TAB to indent or outdent your code.

2978 cards