Places where cron jobs can hide

Cron tasks may be stored in system files or in each user's personal schedule, so hidden automation can be hard to spot when investigating background activity.

Delete from joined MySQL tables

MySQL deletion with joined tables requires naming the target table explicitly, such as deleting posts via a join to authors.

Fixing Web Fonts, A Case Study

Some web fonts with bad hinting can be fixed by applying auto-hinting with Font Squirrel.

Save ActiveRecord models without callbacks or validations (in Rails 2 and Rails 3)

Persist ActiveRecord records directly when callbacks and validations are unnecessary; Rails 2 has create_without_callbacks and update_without_callbacks, while Rails 3 needs sneaky-save.

Fix permissions of temporary RTeX files (which are group and world-readable)

We use RTeX for PDF exports.
While converting LaTeX to PDF, RTeX opens a temporary file which has problematic permissions: Both group and world can read those files.

Although the temp files should go away they sometimes live longer than one would expect.
We patched RTeX to fix this (and have more secure permissions). Place the code below into config/initializers/rtex.rb

Use Sass without Rails

Generate CSS from Sass on a static site without Rails by watching source files and rewriting stylesheets automatically.

Recent RSpec features you might not know about

Less-known RSpec features simplify expectation style, chained stubs, and restoring stubbed methods while using double as the preferred mock object.

A quick guide to pull requests

It’s pretty common for projects hosted on GitHub to receive “pull requests”: requests from people who have cloned your project, made a modification to it and then asking you to merge their changes back into the main project.

There are a lot of ways you can handle these pull requests, here are some of them.

Adding Stroke to Web Text

Because they are vector, it would make sense if we could do things that other vector programs (e.g. Adobe Illustrator) can do with vector text, like draw a stroke around the individual characters. Well, we can! At least in WebKit

Check that a text field is empty with Cucumber

Empty-field checks can pass unexpectedly in Cucumber because "" becomes a regular expression that matches any string. Use ^$ in Capybara or be_blank in Webrat.

Define an array condition that selects on dynamic columns

Safely build dynamic SQL conditions from user-supplied column names and values; sanitize_sql_array works where placeholder syntax fails in MySQL.

Run a rake task in all environments

Use like this:

power-rake db:migrate VERSION=20100913132321

By default the environments development, test, cucumber and performance are considered. The script will not run rake on a production or staging environment.


This script is part of our geordi gem on github.

Run a single example group in RSpec

Run one RSpec example group or a single it example by line number in a long spec without executing the whole file.

Ruby: How to collect a Hash from an Array

Map an array or enumerable to a hash in Ruby using to_h, index_by, group_by, index_with, or a custom collect_hash helper.

Find files modified since a given timestamp

Find files changed after a specific time or within the last day using find age tests and a reference timestamp file.

Create a valid RSS feed in Rails

Valid RSS output in Rails needs strict XML formatting and proper feed metadata; Atom builder can be a safer alternative for syndication feeds.

Get Your C On

Getting started with Ruby extensions in C.

JQuery CSS Emoticons Plugin

Converts plain text emoticons into CSS3 smiley faces with a jQuery plugin and stylesheet, avoiding image files entirely.

Rename hash keys

Ruby hash keys can be renamed with a small initializer, making it easier to migrate data or adjust naming without rewriting every lookup.

Use the new Google Images as a German user

In july Google announced a new version of their image serach tool Google Images. But you won't find it on the German google.de site. To reach the new - as I may say, very much better - tool from germany, you have to surf to images.google.com. Et voilà!

clemens's delocalize at master - GitHub

delocalize provides localized date/time and number parsing functionality for Rails.

Install RubyGems on Ubuntu/Debian

Install a newer RubyGems on Ubuntu or Debian without the outdated APT package, preserving gem access and existing gems when possible.

Remove resource fork files from a FAT volume on MacOS

Hidden ._ resource fork files on FAT volumes clutter car stereos and similar devices. Deleting the AppleDouble metadata from the mounted volume removes them.