Various ruby code snippets