String#indent: Know your definitions!
String#indent is not a standard Ruby method. When you use it, be sure to know where this method comes...
Finding a method name on a Ruby object
Wondering how a specific method on an object is exactly named? You can use Enumerable#grep to detect it in...
How to call overwritten methods of parent classes in Backbone.js
When you are working with Backbone models and inheritance, at some point you want to overwrite inherited methods but call...
Ruby number formatting: only show decimals if there are any
Warning: Because of (unclear) rounding issues and missing decimal places (see examples below), do NOT use this when dealing with...
rbenv: How to switch to another Ruby version (temporarily, per project, or globally)
Unlike RVM, rbenv does not offer a command like rvm use. By default, it respects your project's .ruby-version...
krisleech/wisper
Publish/subscribe for Ruby classes. Bonus: You do not have to declare events before using them.
How to load only a subset of a massive MySQL dump
I had a huge MySQL dump that took forever (as in: days) to import, while I actually just wanted to...
Installing therubyracer and libv8 with Ruby 1.8 on OSX Mavericks
There seems to be no way to use therubyracer -v '0.11.4' and libv8 -v '3.11.8.17' on OS X Mavericks.
How to install older versions of REE with rbenv on Ubuntu 12.04
Rbenv won't compile REE 2011.03 properly on Ubuntu 12.04, failing with an error in tcmalloc.cc. If you want to...
Support for Ruby version 1.9.3 will end on February 23, 2015
The new Modularity 2 syntax
We have released Modularity 2. It has many incompatible changes. See below for a script to migrate your applications automatically...
Opal, A new hope (for Ruby programmers)
Opal is a source to source ruby to javascript compiler, corelib and a runtime implementation that currently passes 3000 rubyspecs...
Sort a Ruby array with multiple criteria
If you want to sort a Ruby array with a primary, secondary, etc. criterium, use a sort_by that contains...
How to fix "undefined method `name' for Array" error when running bundled commands on Ruby 1.8.7 + Rails 2.3
On recent/fresh installations of Ruby 1.8.7 you may encounter this error why calling any bundled binary (or just bundle exec...
Auto-coerced virtual attributes with Virtus
We've since created ActiveType which has a restricted subset of Virtus' features. It might be enough for your needs...
Careful when calling a Ruby block with an array
When a Ruby block or proc takes multiple parameters, and you call it with an Array, Ruby will unexpectedly splat...
Embed Font Awesome icons from your CSS
An annoying part of using font icons is that the icons usually need to live in the DOM. This is...
Ruby constant lookup: The good, the bad and the ugly
In Ruby, classes and modules are called constants. This card explains how Ruby resolves the meaning of a constant.
Ruby: How to measure code execution time in an IRB or Rails console
Paste this method into your console: def time(&block) puts Benchmark.measure(&block) end Now time { Some.lengthy_task } will behave similar...
Cancelling the ActiveRecord callback chain
What Rails version Within before_* Within after_* Cancel later callbacks Rails 1-4 return false return false Cancel later callbacks...
Ruby 1.8: SimpleDelegator is very slow
If you're still working on ruby 1.8, you should know that using SimpleDelegator is often prohibitively slow. I have...
How to subscribe to Ruby security updates
Ruby publishes security issues and MRI updates on ruby-lang.org. Unfortunately there is no straight-forward way to subscribe to these...
Fix „command failed: /usr/bin/wkhtmltopdf ...“ using PDFKit middleware
Ubuntu 12.04 LTS x64, Ruby 1.8.7, Rails 2.13, PDFKit 0.5.4, Phusion Passenger Apache 2 I ran into this, when I...
Ruby: The & operator
After reading, you will know why and how runners.each(&:run) works. Here some tidbits: & can be quite confusing because it...