Just want to note, as the author, that this post is almost 18 months old now and I don't necessarily stand by them all anymore ;-) (I'd need to go back and re-edit to make <i>that</i> assertion..)
Careful with one of those tips [* x] does return x if x is an array and [x] otherwise except in the case where x is a hash in which case it transforms the hash to an array. Eg:<p>x = {:a => 1, :b => 2}<p>[* x]<p>=> [[:a, 1], [:b, 2]]<p>Some of the other tips just make the code less readable
I often do the %w{rubygems sinatra etc}.each{|lib| require lib} trick. If I were more motivated, I would submit a patch that would allow require to take an array.
<p><pre><code> >> 3. Format decimals
>> money = 9.5
>> "%.2f" % money # => "9.50"
</code></pre>
Seriously? IMHO These sorts of things are not nice. To read the code you have to know these special magic operators. It's not immediately obvious it's calling a function to do string formatting.<p>Readable code is so important :/