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) # => "&lt;élan&gt;"

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/')

apidock.com

To temporarily change the current working directory in Ruby, call Dir.chdir with a block. The previous working directory will be...

yehudakatz.com

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...

nokogiri.org

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.

Regular spaces and non-breaking spaces are hard to distinguish for a human. Instead of using the &nbsp; HTML entity...

blog.jcoglan.com

Terminus is a Capybara driver where most of the driver functions are implemented in client-side JavaScript. It lets you...

github.com

Sometimes you inherit a non Rails or non Rack based web app such as PHP, Perl, Java / JEE, etc. I...

If you get an error message like that you are missing the Aspell files a specific language:

github.com

Hooks lets you define hooks declaratively in your ruby class. You can add callbacks to your hook, which will be...

timetobleed.com

This post will describe how I stumbled upon a code path in the Linux kernel which allows external programs to...

It can be useful to have a Ruby expression like condition ? positive_case : negative_case in MySQL queries:

makandra dev
ruby-doc.org

[ ] [ ]= ** ! ~ + - * / % + - >> << & ^ | <= < > >= <=> == === != =~ !~ && || .. ... ? : = %= { /= -= += |= &= >>= <<= *= &&= ||= **= defined? not or and if unless while until begin/end For more information see Table 18.4 in The Pragmatic Programmer's...

A good tool to generate strong passwords and secrets is "apg". You can get it with sudo apt-get install...

github.com

Ruby gem that provides an AR-style interface for the Pivotal Tracker API.

You need to install the following packages before you can build the Paperclip gem: sudo apt-get install imagemagick librmagick...

makandra dev

A popular ruby idiom I keep stumbling upon is def do_some_thing_for(values) values = Array(values)

Find conditions for scopes can be given either as an array (:conditions => ['state = ?', 'draft']) or a hash (:conditions => { 'state' => 'draft...