This tool is used on our application servers (and called when deploying) but it also works locally. Just call dumple...

To test whether two arrays have the same elements regardless of order, you can use the =~ matcher in RSpec < 2.11...

Note that this sounds good but is not good at all when hooking tasks on cap deploy (see this article...

This note describes a Cucumber step definition that lets you say: Then "Mow lawn" should be an option for "Activity...

When you try to remove a non-existing index using remove_index, the migration will incorrectly pass without an error...

github.com

jQuery plugin to register callback functions to keyboard shortkuts. Keyboard events in vanilla Javascripts are super-painful to work with...

A check if two date or time ranges A and B overlap needs to cover a lot of cases:

Note: Consider not doing this. Use form models or vanilla methods instead. The :conditions option for Rails associations cannot take...

alfajango.com

The difference between .bind(), .live(), and .delegate() is not always apparent. Having a clear understanding of all the differences, though...

Sometimes it is useful to define a named scope by implementing a static method with the scope's name on...

Given group size If you would like to split a Ruby array into pairs of two, you can use the...

This might be due to AppArmor denying the MySQL server access to most of the filesystem. You can instead use...

There are times when you need to send SQL to the database, like this: def self.some_count(field) field = connection.quote...

opensoul.org

I love ETags, but there’s something that annoys me: most implementations revolve around pulling a record out of a...

Find-as-you-type boxes are usually built by observing changes in a text field, and querying the server via...

kernel.org

Git allows you to do a binary search across commits to hunt down the commit that introduced a bug.

alistapart.com

I was recently confronted with the task of creating a two-column liquid layout with a header and footer in...

In order to redirect all requests from redirecting-host.com to desired-host.com while keeping path and query params unchanged, change your Apache...

In regular expressions you can use the zero-width pattern \b to match the beginning or end of a word...

makandra dev

If you need to export data from MySQL to a CSV, you can profit from really fast built-in methods...

makandra dev

To clear the query cache in your MySQL database manually, e.g. for database profiling, execute the following command in your...

So you added a new callback to your model that (e.g.) caches some data when it is saved. Now you...

gurge.com

How to write to the db 27,000 times in 24 seconds instead of 9 minutes.

When you eagerly load an association list using the .include option, and at the same time have a .where on...