Skip to content

Instantly share code, notes, and snippets.

@turtlemonvh
turtlemonvh / README.md
Last active November 9, 2022 17:51
Golang Equal JSON Strings

JSON string equality

A little utility for testing if 2 json strings are equal, for use in tests.

Example

go run main.go '{"dog": 5, "cat": 3}' '{"cat":3, "dog": 5}'

Caveats

@nathanl
nathanl / exponential_backoff.rb
Created February 25, 2015 14:41
Exponential backoff in Ruby
# Exponential backoff in Ruby
begin
make_request
rescue RequestError => e
if retries <= max_retries
retries += 1
sleep 2 ** retries
retry
else
raise "Timeout: #{e.message}"