stackoverflow.com

There are many solutions, but a very concise one is this: hash.merge!(hash) do |key, old_value, new_value|

Sometimes you want to know exactly how many objects exist within your running Ruby process. Here is how: stats = {} ObjectSpace.each...

bugs.ruby-lang.org

This is basically Ruby-native syntax for andand.

stackoverflow.com

Ruby has a set of methods to convert an object to another representation. Most of them come in explicit and...

When you make a simple TCP connection to a remote server (like telnet), your client won't normally notice when...

You want to test your 1GE or 10GE internet uplink? We needed to ensure we have full 10GE to the...

Ruby allows multiple assignment: a, b, c = o In order to prove multiple values from a single object, Ruby calls...

github.com

When a method has keyword arguments, Ruby offers implicit conversion of a Hash argument into keyword arguments. This conversion is...

makandracards.com

Writing ruby methods that accept both optional and keyword arguments is dangerous and should be avoided. This confusing behavior will...

Starting with Rails 4.0, when you get an exception reported via the ExceptionNotification gem, you will only see a very...

makandra dev

Starting with Ruby 1.9, most #each methods can be called without a block, and will return an enumerator. This is...

github.com

Rails 5 will introduce ActiveRecord::Relation#or. On Rails 4 and 3.2 you can use the activerecord_any_of gem...

To safely transport an arbitrary string within a URL, you need to percent-encode characters that have a particular meaning...

bibwild.wordpress.com

While debugging an intricate issue with failed HTTP requests I have come to appreciate the more advanced features of the...

If you have problems installing a gem and get a error collect2: error: ld returned 1 exit status it's...

Ruby has Enumerable.find(&block), which returns the first item in the collection for which the block evaluates to true.

To update your Rubygems to the latest available version, type the following: gem update --system Note that you have a...

On Ruby 1.9+, standard ruby character classes like \w, \d will only match 7-Bit ASCII characters: "foo" =~ /\w+/ # matches...

To check which rubygems versions your different rbenv rubys are using, you can use this small bash script:

github.com

MarcoPolo shows your app name and environment in your console prompt so you don't accidentally break production Officially supporting...

Here is how to start your Rails application to accept both HTTP and HTTPS in development. gem install passenger

makandra dev

CTRL + SHIFT + ALT + N Search for any symbol in your application, like CSS classes, Ruby classes, methods, helpers etc...

makandra dev
github.com

The Bullet gem is designed to help you increase your application's performance by reducing the number of queries it...

nateberkopec.com

Very detailed guide to caching Ruby on Rails. Goes well with the official Rails guide on caching.