Code Snippets

Language: Ruby

Generate SHA256 Hash in Ruby

Compute the SHA256 hex digest of any string with Digest::SHA256.

Author: chris

Parse and Generate JSON in Ruby

Parse a JSON string into a Hash and convert back with the json stdlib.

Author: chris

HTTP GET with Net::HTTP

Stdlib HTTP GET request using Net::HTTP and URI.

Author: chris

Read a File into a String

Slurp an entire file into a string with File.read, the idiomatic Ruby way.

Author: chris