When a Ruby block or proc takes multiple parameters, and you call it with an Array, Ruby will unexpectedly splat...

Sometimes you need to monitor a connection from your machine to a specific, single host or network in order to...

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

Today I ran into trouble installing therubyracer on Ruby 1.8. The installation failed with *** extconf.rb failed *** Could not create Makefile...

Rails has always included a scaffold script that generates a default controller implementation for you. Unfortunately that generated controller is...

It is good programming practice to Don't Repeat Yourself (or DRY). In Ruby on Rails we keep our code...

So you client has asked you to implement a row of buttons to like the URL on Facebook, Twitter and...

I recently experienced the error ActiveRecord::StatementInvalid: Mysql2::Error: closed MySQL connection. Apparently this happens when there is a timeout...

After running bundler / gem install I could not load nokogiri lately. It died with cannot load such file -- nokogiri/nokogiri.

In order to keep the controllers directory tidy, we recently started to namespace controllers. With the :controller option you can...

web.archive.org

Capistrano 2 brings the shell command which allows you to run commands on your deployment targets. There is also invoke...

Simply give the select helper an option :disabled, passing either a single value or an array. You need to specify...

jimneath.org

The linked page lists and explains global Ruby "dollar" variables, such as: $: (load path) $* (ARGV) $? (Last exit status) $$ (PID)

makandra dev

Ruby 1.9 brings a shorter way to define lambdas using the -> operator: twice = -> (x) { 2 * x } twice.call(5) # => 10

Connect to your memcached host. (AWS elasticache is memcached) telnet foohost23.cs2631.0001.euw1.cache.amazonaws.com 11211 Once you're connected, find out which 'slabs...

1. Saving files to a directory that is not shared between deploys or servers If you save your uploads to...

This card shows how to upgrade a Rails 2 application from Rails 2.3.8 through every single patch level up to...

The Rails secret_token must be unique for each application and any instance of it. If not, someone could exploit...

Our development process makes us deploy very often. As the number of releases grows, junk clogs up the hard drive...

When you need to find out in which kind of spec you are during run-time, it's definitely possible...

makandra dev

git shortlog -s -n [commit-range] -n, --numbered Sort output according to the number of commits per author

Option 1: Creating a self-signed certificate with the openssl binary As igalic commented on this gist. openssl req -new...

This trick might be useful to implement more complicated directives in AngularJS. I needed it to do drag'n'drop...

Rails gives you migrations to change your database schema with simple commands like add_column or update. Unfortunately these commands...