Code Snippets

Language: Ruby

Generate a UUID in Ruby

Generate a v4 UUID with the SecureRandom stdlib.

Author: chris

ActiveRecord Query Snippet

Define a model and run a chained where/order query with ActiveRecord.

Author: chris

Recursive Glob in Ruby

Find every `.rb` file under a tree with Dir.glob and `**` recursion.

Author: chris

Sort Array of Hashes by Key

Sort an array of hashes by a numeric attribute using sort_by.

Author: chris