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"
External content

Creating a multi-resolution favicon including transparency with the GIMP

The result is a .ico file with multiple versions of your logo at different resolutions. Now, depending on the context, visitors to your site will see your nice favicon in their browser tabs, superimposed on whatever browser chrome they're using in all of its transparent glory.

Scroll a textarea to a given line with jQuery

You can use this code:

function scrollToLine($textarea, lineNumber) {
  var lineHeight = parseInt($textarea.css('line-height'));
  $textarea.scrollTop(lineNumber * lineHeight);      

Some caveats about this code:

  1. Your textarea needs to have a line-height in Pixels.
  2. The code will scroll to the line number in the text area, not the line number of the original text. These will differ if any lines wrap at the edge of the textarea.

Also see our solution for [scrolling a textarea to a given position with jQuery](htt…

Uncaught exception in PassengerServer client thread exception: Cannot accept new connection: Too many open files

So you probably see the following error trace within your Passenger log file if you got here:

[ pid=123 thr=1401414 file=ext/nginx/HelperAgent.cpp:964 time=2012-04-27 10:01:49.273 ]: Uncaught exception in PassengerServer client thread:
   exception: Cannot accept new connection: Too many open files (24)
     in 'Passenger::FileDescriptor Client::acceptConnection()' (HelperAgent.cpp:429)
     in 'void Client::threadMain()' (HelperAgent.cpp:953)

You can either

  1. Lower the maximum number of running Passenge…
External content


CodeMirror is a JavaScript component that provides a code editor in the browser. When a mode is available for the language you are coding in, it will color your code, and optionally help with indentation.

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.

How to access a dmcrypt-encrypted partition from outside your system

This is for you when you want to mount a dmcrypt encrypted partition manually, e.g. from a live CD.

First, open the dmcrypted partition (You need to provide some name. It may, but does not need to, be your LVM group name):

cryptsetup luksOpen /dev/sda5 some_name

Since your encryption container most likely contains an LVM group (root + swap for example), enable the logical volume manager (replace LVM_NAME with your volume group's name):

vgchange -ay LVM_NAME

After that, you can your access (mount, [fsck](https://makandrac…

Browser support for box-shadow

Basic box shadow support is available in all browsers today, but you need to check to which extend they are supported. Implementations differ:

  • Are multiple box shadows (separated by comma) possible?
  • Are inset shadows possible?
  • Can the spread radius be defined?
  • Can you use it without vendor prefix?

A good compatibility chart can be found here. The gist is that, except for IE and some Safaris, you can use all features …

Convert primitive Ruby structures into Javascript

Controller responses often include Javascript code that contains values from Ruby variables. E.g. you want to call a Javascript function foo(...) with the argument stored in the Ruby variable @foo. You can do this by using ERB tags (<%= ruby_expression %>) or, in Haml, interpolation syntax (#{ruby_expression}).

In any case you will take care of proper quoting and escaping of quotes, line feeds, etc. A convenient way to do this is to use Object#json, which is defined for Ruby strings, numb…

External content

zClip :: jQuery ZeroClipboard

zClip is a lightweight jQuery "copy to clipboard" plugin built using the popular Zero Clipboard library. This plugin uses an invisible Adobe Flash movie that is fully compatible with Flash Player 10 and below.

xterm: Have a black background by default

xterm by default uses black text on white background.

To change that to something like "light gray on black", do a

vim ~/.Xresources

…and put this in there:

xterm*background: black
xterm*foreground: lightgray

Afterwards, feed these changes to your current X session:

xrdb ~/.Xresources

Any subsequent xterm will be colored white on black background.


  • While you're at it, you can also set xterm's font in your ~/.Xresources file. Just add xterm*faceName: monospace:pixelsize=14.
  • If you don't want to chan…

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.

How to check your file system's integrity with fsck

To force a check on your next reboot (here for your root partition), simply:

touch /forcefsck

To manually do this, here is how to do it for the first partition on sda, when you are using ext4:

fsck.ext4 -fn /dev/sda1
  • -f forces the check, even if everything seems okay.
  • -n is a "read only" check, where nothing is changed and every question is answered with "no".
  • When using dmcrypt, you probably want to check s…

Fix Capistrano warnings: Missing public directories

I got these warnings while deploying a Rails 3.2 app with asset pipeline enabled:

*** [err :: host.tld] find: `/opt/www/': No such file or directory
*** [err :: host.tld] find: `/opt/www/': No such file or directory
*** [err :: host.tld] find: `/opt/www/': No such file or directory

Folders like public/javascripts might not exist if you're using the asset pipeline (…

Git: Change the text editor used to enter commit messages

In your ~/.gitconfig:

External content


A small library to provide the Rails I18n translations in Javascript clients.

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](…

2974 cards