Skip to content

Instantly share code, notes, and snippets.

@ayanko
ayanko / uuid_generators.rb
Last active September 13, 2021 19:59
Compare and Bench Different UUID generators based on SecureRandom
# frozen_string_literal: true
require 'securerandom'
require 'ulid'
require 'benchmark'
require 'benchmark/ips'
module UuidGenerator
extend self
@ayanko
ayanko / typhoeus_abort_requests.rb
Last active November 10, 2021 07:19
typhoeus_abort_requests
# frozen_string_literal: true
# Example that demonstrate how to abort requests in hydra when we reach some state.
# It based on :abort feature of streaming response.
#
# See https://github.com/typhoeus/typhoeus#streaming-the-response-body
#
# ```
# $ ABORT_ON_FIRST_REQUEST=false ruby ./typhoeus_abort_requests.rb
# $ ABORT_ON_FIRST_REQUEST=true ruby ./typhoeus_abort_requests.rb