Ruby function to check if something is a number
def is_a_number?(s) s.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil? false : true end
Rails Plugins with SVN
I'm working with a plugin that I wrote. I want to pull the plugin into an app I'm writing, but still be able to make...
Rake tasks
How can I search for available rake tasks? rake -T | grep gem (where "gem" is the thing you are searching for) The above example...
Working with gems
Gems are installed by sources, or a repository which holds several gems. Generally all the gems you will need are either in gems.rubyforge.org or gems.github.com,...
MySQL Dumping Cheat-Sheet
Make a quick dump of a mysql database: mysql_dump db_name > backup-file.sql You can then read that dump file back into the server like this...
List of Ruby Operands
operandwhat it does shift position of bits in Bignum and Fixnum ~bitwise NOT (high-presendence) &bitwise AND (medium-presendence) |bitwise OR (medium-presendence) ^bitwise XOR (medium-presendence) **exponent +addition...
Tips for Working with Rails
Go to script/console to open ruby in interactive mode. script/console loads your environments (everything in environment.rb and all your plugin and gem initializers), so you...
Passenger with Rails
Passenger is a great thing because it makes Rails apps able to be deployed on Apache. The installation is pretty painless, but there are a...
Show all hidden files in the Finder windows
Type this in terminal: defaults write com.apple.Finder AppleShowAllFiles TRUE KillAll Finder To hide the hidden files again: defaults write com.apple.Finder AppleShowAllFiles FALSE KillAll Finder
SVN cheat sheet
Setup the working copy of the repository svn checkout First navigate to the root of your working copy. svn status This will list any files...