If you want to find the commits that touched a specific text in a file, use git log -S 'text...
When your controller action raises an unhandled exception, Rails will look at the exception's class and choose an appropriate...
PostgreSQL, unlike MySQL, treats strings as case sensitive in all circumstances. This includes comparison with = and LIKE collision detection in...
Is your application doing something expensive every few seconds? Maybe an animated slider that rotates images? Maybe you are updating...
By convention, common protocols use a defined port, like 80 for HTTP or 443 for HTTPS. You can use nmap...
When building a web application, one is tempted to claim it "done" too early. Make sure you check this list...
Chrome's developer tools automagically choose vertical or horizontal panel layout, based on their width. You can disable that magic...
As your Rails project grows, you will accumulate a number of small patches. These will usually fix a bug in...
When dealing with time zones in Rails, there is one key fact to keep in mind: Rails has configurable time...
Expecting a primitive value as an argument to a method invocation is easy: expect(object).to receive(:foo).with('arg1...
This card existed before, but was outdated due to browser implementation changes. The information below is validated for the current...
RSpec provides a nice diff when certain matchers fail. Here is an example where this diff is helpful while comparing...
If you are on a Linux shell and want to open a file with whatever default application is configured for...
TL;DR There are three dimensions you can control when scoping routes: scope module: 'module', path: 'url_prefix', as: 'path...
Our preferred way of testing ActiveRecord is to simply create/update/destroy the record and then check if the expected behavior has...
Validations should be covered by a model's spec. This card shows how to test an individual validation. This is...
If you expect method calls in RSpec 3, be aware that the argument matchers use very liberal equality rules (more...
A HTTP 302 Found redirect to PATCH and DELETE requests will be followed with PATCH or DELETE. Redirect responses to...
The nokogiri gem provides different packages for several platforms. Each platform-specific variant ships pre-built binaries of libxml2, e.g...
Ruby has the class Proc which encapsulates a "block of code". There are 2 "flavors" of Procs: Those with "block...
Our applications not only need to be functional, they need to be fast. But, to quote Donald Knuth, premature optimization...
This is a guide on how to effectively use Git when working on a feature branch. It is designed to...
Starting with Ruby 1.9, most #each methods can be called without a block, and will return an enumerator. This is...
To safely transport an arbitrary string within a URL, you need to percent-encode characters that have a particular meaning...