small but smart code snippets in Ruby