Bare-minimum Sinatra app responding to GET /.
All snippets
The latest code snippets.
Find every `.rb` file under a tree with Dir.glob and `**` recursion.
Sort an array of hashes by a numeric attribute using sort_by.
Use named captures and MatchData to extract fields.
Compute the SHA256 hex digest of any string with Digest::SHA256.
Parse a JSON string into a Hash and convert back with the json stdlib.
Stdlib HTTP GET request using Net::HTTP and URI.
Slurp an entire file into a string with File.read, the idiomatic Ruby way.
Spawn a child process with fork() and wait for it to exit.
MIME::Base64 round-trip for binary-safe text encoding.