You can use xmllint to pretty-print ugly XML files on your terminal. Just say: xmllint --format file.xml

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

Active Record's select method allows you to make use of the power of MySQL select statements. On the one...

In order to clone a git repository including all branches and tags you need to use two parameters when cloning...

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

Sometimes you need a piece of code to do something different for specs than for features. If you don't...

Sometimes you want git to ignore certain files that appear on your machine. You can do this in 3 ways...

Getting a regular expression from a string in JavaScript is quite simple: new RegExp('Hello Universe'); # => /Hello Universe/

We have often felt the pain where our models need to serve too many masters. E.g. we are adding a...

In the following example the method update_offices_people_count won't be called when office_id changes, because it...

highscalability.com

Awesome battle report from Pinterest trying to scale their setup using different approaches. When you push something to the limit...

In specs, the session never persists but is always a new object for each request. Data put into the session...

apidock.com

All columns of a model's database table are automagically available through accessors on the Active Record object.

nt.ntnu.no

yaml4r is a juxtaposition of yaml documents and their Ruby couterpart. Thus, it does a great job as YAML-doc...

The User-Agent HTTP header identifies the client and is sent by "regular" browsers, search engine crawlers, or other web...

makandra dev

Ever wondered about the difference between def and define_method? Turns out there are three implicit contexts in Ruby. def...

The way Rational#to_s works on Ruby has changed from Ruby 1.9 on. Here is how to get the...

When a controller action redirects to an external URL (like http://somehost.com/some/path) you will find that this is hard...

tenderlovemaking.com

In Ruby, the meaning of protected and private is different from other languages like Java. (They don't hide methods...

stackoverflow.com

Access the Method object Dead simple: Get the method object and ask for its owner: "foo".method(:upcase) # => #

Rails flashes (FlashHash) track a list of used keys, which is not respected when comparing flash hashes.

coding.smashingmagazine.com

Smashing Magazine lists some handy tricks for print style sheets, all with CSS: Expand External Links For Print

browserhacks.com

The linked site lists a wealth of CSS hacks that let you apply styles to just that one browser. You...

ariejan.net

Rails understands a :limit options when you create columns in a migration. Its meaning depends on the column type, and...