I was going through some bookmarks today and I came across a few cheatsheets that I thought would be of interest to readers.
First, there’s Jens-Christian Fischer’s PDF cheatsheet for Rails. It doesn’t cover version 1.2, but most of the information is still relevant. When you need to look something up quickly, you can just search the PDF. Handy.
Another Rails cheatsheet I really like is from ilovejackdaniels.com. It’s a good quick reference that includes the default directory structure, predefined variables, reserved words, and more. Definitely one to check out.
If you’re looking for a Ruby-only cheatsheet, try RubyCheat on for size. And while technically not a cheatsheet, I also find ZenSpider’s Ruby QuickRef pretty useful when the PickAxe is not handy.
Choice Gem: cheat
Speaking of cheats, one of my favorite Ruby Gems as of late is Chris Wanstrath’s cheat.
As with all Ruby Gems, it’s easy to install:
$ sudo gem install cheat Bulk updating Gem source index for: http://gems.rubyforge.org Successfully installed cheat-1.2.1
Basic usage is straightforward: you run the cheat program and give it the name of the cheatsheet as an argument. So, if you forget all your MySql commands, you can just run cheat mysql.
Here’s another example, and one I use all the time—strftime (output truncated, of course):
$ cheat strftime
strftime:
%a - The abbreviated weekday name (``Sun'')
%A - The full weekday name (``Sunday'')
%b - The abbreviated month name (``Jan'')
%B - The full month name (``January'')
...
There are a bunch of Rails-related sheets which you can see by typing cheat rails. Here’s the full list:
- radrails_rhtml
- radrails_ruby
- rails_console
- rails_edge
- rails_request_object
- rails_reserved_words
- rails_tasks
- rails_to_s
- rails_vim
- test_spec_rails
- textmate_rails
So, if you’re trying to check out a working copy of edge rails, but forget the path to the Rails subversion repository, you can quickly type cheat rails_edge to be reminded.
To see all available cheatsheets in a big long list, do this:
$ cheat sheets All Cheat Sheets: arts as3_formulas ascii assertions assert_select association_methods awk balloon bash ...
Finally, to see more of what you can do with cheat, including examples and useful command line flags, use cheat’s own cheatsheet:
$ cheat cheat cheat: Hey, welcome to cheat (http://cheat.errtheblog.com). Thanks for trying it out. ...
Happy cheating!

