# ======================================================================
# @link
# Function: confirm
# Asks the user to confirm an action, If the user does not answer "This won't shutdown the Internet!" the script will immediately exit.
# Parameters:
# $@ - The confirmation message
View ruby-1.9-tips.rb
def tip(msg); puts; puts msg; puts "-"*100; end
# 30 Ruby 1.9 Tips, Tricks & Features:
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
View ruby_191_hacks.rb
# Drop this file in config/initializers to run your Rails project on Ruby 1.9.
# This is three separate monkey patches -- see comments in code below for the source of each.
# None of them are original to me, I just put them in one file for easily dropping into my Rails projects.
# Also see original sources for pros and cons of each patch. Most notably, the MySQL patch just assumes
# that everything in your database is stored as UTF-8. This was true for me, and there's a good chance it's
# true for you too, in which case this is a quick, practical solution to get you up and running on Ruby 1.9.
# Andre Lewis 1/2010
# encoding: utf-8
View Evolution of a Ruby Programmer.rb
# Newbie Programmer
def factorial(x)
if x == 0
return 1
return x * factorial(x - 1)
puts factorial(6)
puts factorial(0)
View README.rdoc