Skip to content

Instantly share code, notes, and snippets.

@ardecvz
ardecvz / refinements_activation_bench.rb
Last active July 30, 2026 19:52
A benchmark of Ruby refinements activation cost: `using` slows down with the number of classes loaded in the process on Ruby < 4.0 (bug #21201, fixed by the refinement-cache table)
# frozen_string_literal: true
# Activating a refinement (`using`) on Ruby < 4.0 triggers a full object-space
# scan to invalidate method caches, so its cost grows with the number of classes
# already loaded in the process.
# Ref: https://bugs.ruby-lang.org/issues/21201
#
# This benchmark generates N classes, then loads a refinement-heavy gem
# (`anyway_config`). Compare a small and a large N, with refinements on and off:
#
@ardecvz
ardecvz / vcr_intro.rb
Last active May 14, 2024 08:22
A VCR trick to include preparation and cleanup phases for external services directly within the test files (the phases run ONLY when recording cassettes)
# frozen_string_literal: true
# A VCR trick to include preparation and cleanup phases for external services
# directly within the test files (the phases run ONLY when recording cassettes):
#
# RSpec.describe EvilMartiansAPI::Client, vcr: true do
# let(:client) { described_class.new }
#
# let(:developer_team_number) { 42 }
#
@ardecvz
ardecvz / 00_evil_martians_api_client.md
Last active January 26, 2026 13:41
A ready-to-use example that features an opinionated Faraday configuration, optionally serving as a starting point for your own HTTP client
├── bin
│   └── console
├── config
│   └── evil_martians_api.yml
├── lib
│   ├── evil_martians_api
│   │   ├── api
│   │   │   └── developers.rb
│ │ ├── client
@ardecvz
ardecvz / keybase.md
Created March 27, 2023 14:31
keybase.md

Keybase proof

I hereby claim:

  • I am ardecvz on github.
  • I am ardecvz (https://keybase.io/ardecvz) on keybase.
  • I have a public key ASBzpk2uJ4ifi3Y4WJgw_Mig92jT5U-MfiTOb6Fswzqj9go

To claim this, I am signing this object: