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
Achieving Developer Excellence with Automated Testing
Posts related to Ruby, Rails, other programming topics. Highly technical.
def is_a_number?(s) s.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil? false : true end
I’m working with a plugin that I wrote. I want to pull the plugin into an app I’m writing, but…
How can I search for available rake tasks? rake -T | grep gem (where “gem” is the thing you are…
Gems are installed by sources, or a repository which holds several gems. Generally all the gems you will need are…
Make a quick dump of a mysql database: mysql_dump db_name > backup-file.sql You can then read that dump file back…
operand what it does shift position of bits in Bignum and Fixnum ~ bitwise NOT (high-presendence) & bitwise AND (medium-presendence)…
Go to script/console to open ruby in interactive mode. script/console loads your environments (everything in environment.rb and all your plugin…
Passenger is a great thing because it makes Rails apps able to be deployed on Apache. The installation is pretty…
Type this in terminal: defaults write com.apple.Finder AppleShowAllFiles TRUE KillAll Finder To hide the hidden files again: defaults write com.apple.Finder…
Setup the working copy of the repository svn checkout First navigate to the root of your working copy. svn status…