From the archive
Ruby
Ruby programming tutorials, best practices, and advanced techniques for building robust applications
- ↗
A unique key doesn't make a Sidekiq job retry-safe
A Ruby experiment shows why a unique payment record can hide unfinished work, and how retries can resume it with one stable operation key.
Includes verification notes - ↗
Your first Ruby gem: test the package, not just the source file
Build a small slug gem with a precise Unicode policy, Minitest checks and an isolated build-install-load test. No publishing account required.
Includes verification notes - ↗
Ruby design patterns: make undo and redo survive a new branch
Implement the Command pattern with a tested history cursor. Handle undo-all, branching, failed commands and external edits without negative-index surprises.
Includes verification notes - ↗
Ruby metaprogramming: generate a small API without hiding its rules
Build a typed settings DSL with define_method, then test reflection, validation, inheritance and shared defaults. No eval or method_missing required.
Includes verification notes - ↗
Sinatra, Rails and Roda: Compare One HTTP Contract
Compare Sinatra, Roda and Rails API controller routing against one JSON request contract, with 33 passing Rack tests and locked Ruby dependencies.
Includes verification notes - ↗
Predicting Exam Outcomes in Ruby: Split Before You Scale
Use Rumale to fit preprocessing on training rows only, evaluate a synthetic exam-outcome fixture and inspect threshold errors against a baseline.
Includes verification notes - ↗
Ruby functional pipelines: make failure a value that stops the next step
Implement a small Ok/Err pipeline in Ruby. Test short-circuiting, map versus bind, false and nil values, and errors that should still raise.
Includes verification notes - ↗
LeetCode in Ruby: test the invariant behind three useful patterns
Implement lower-bound search, a unique-character window and a min-heap in Ruby. Check duplicates, empty input and seeded comparisons with simple oracles.
Includes verification notes - ↗
Ruby to PyTorch: test the process boundary before CUDA
Call a real PyTorch worker from Ruby with an explicit JSON contract, tested error paths and a clear boundary between CPU checks and CUDA execution.
Includes verification notes - ↗
Build a Bayesian text classifier in Ruby, then check the arithmetic
Implement multinomial Naive Bayes with word counts, smoothing and log scores. Test unknown words, empty input and a small held-out fixture.
Includes verification notes - ↗
Amazon Transcribe in Ruby: Separate Starting, Waiting and Reading
Separate Amazon Transcribe submission, bounded polling and authenticated S3 output reading in Ruby, with tested SDK stubs for failures and empty results.
Includes verification notes - ↗
A Ruby Coin Collector: Gosu Rendering, Testable Game Rules
Build a Gosu coin collector with normalized movement and testable collisions: eight Ruby model tests and a short native window smoke run.
Includes verification notes - ↗
Functional programming in Ruby: keep the export, lose the mutation
Build a tested order-to-CSV pipeline with map, select and sum. Check input ownership, quoting, invalid rows and the limits of lazy evaluation.
Includes verification notes - ↗
Ruby vs Elixir: compare the state transition before the syntax
Run the same lost-update experiment in Ruby and Elixir. See why a mutex or single-owner process needs to protect the whole operation.
Includes verification notes - ↗
Ruby and Sonic Pi: Build a Four-Beat Phrase You Can Inspect
Compose a four-beat Sonic Pi phrase and inspect its note schedule with seven Ruby tests, while keeping score checks separate from actual audio playback.
Includes verification notes - ↗
Speech Recognition in Ruby: Send Audio Bytes, Handle Every Result
Build a Google Speech-to-Text V1 request from local audio bytes and extract segmented results, with real Ruby protobuf and SDK method tests offline.
Includes verification notes - ↗
Machine Learning in Ruby: Train, Check and Reload a Ruby-FANN Network
Train an actual Ruby-FANN XOR network, validate inputs and reload saved weights using a documented Ruby 3.3 compatibility build.
Includes verification notes