If you want to iterate over a Range, but only look at every n-th element, use the step method...
When your block takes an argument that should have an default, only in Ruby 1.9 you can say: block = lambda...
This must be one of the coolest, yet quite unknown, technique in Ruby. For certain types of problems (e.g. when...
In regular expressions you can use the zero-width pattern \b to match the beginning or end of a word...
How to create an infinitely nestable hash that always defaults to a new hash if a key does not map...
Ruby's net/http is setup to never verify SSL certificates by default. Most ruby libraries do the same. That means...
Sometimes, you just need to shoot from the hip…or deploy your local changes without committing them. Put this snippet...
If you want to find out whether a Class object is directly inheriting from another class, use superclass: ActiveRecord::RecordNotFound.super...
RSpec 1, RSpec 2 To test whether two arrays have the same elements regardless of order, RSpec 1 and 2...
Use the htmlentities gem. Encoding works like this: require 'htmlentities' coder = HTMLEntities.new string = "<élan>" coder.encode(string) # => "<élan>"
You can get YAML.load to instantiate any Ruby object by embedding the desired class name into the YAML code. E.g...
Use the Launchy gem: Launchy.open('http://www.ruby-lang.org/')
To temporarily change the current working directory in Ruby, call Dir.chdir with a block. The previous working directory will be...
The first thing you need to understand is that the purpose of refinements in Ruby 2.0 is to make monkey...
If you need to do calculations inside the database and can not use Ruby objects you may run into problems...
This card explains how to install RubyMine for the first time. If you want to upgrade an existing RubyMine installation...
Because Nokogiri needs to be compiled and dynamically linked against both libxml2 and libxslt, it has gained a reputation for...
When you just went through a long debug-fest and infested your code with dozens of debug messages, it can...
Occasionally some complex query must be processed on the database because building thousands of Ruby objects is impracticable.
Plugins (and gems) are typically tested using a complete sample rails application that lives in the spec folder of the...
As a user of Bundler you have spent significant time looking at this message: Fetching source index for http://rubygems.org...
Regular spaces and non-breaking spaces are hard to distinguish for a human. Instead of using the HTML entity...
This is a bash script for those of you who need to install all gems for all projects (e.g. to...
Terminus is a Capybara driver where most of the driver functions are implemented in client-side JavaScript. It lets you...