Ruby Tricks

Remove All but Word Characters from String
s.gsub(/\W+/,'') Lowercase: s.gsub(/\W+/,'').downcase

One-Liners
Factorial one-liner: ruby -e "def fac(n) if n<=1 then 1 else fac(n-1)*n end end ; puts fac(10)" Shorter and uglier factorial: ruby -e "def f(n)n<2?1:f(n-1)*n end;puts f(10)"