Rails: Testing the number of database queries
N+1 queries and excessive eager loading can be caught by asserting exact database query counts in specs with the make_database_queries RSpec matcher.
RSpec: Executing specs by example id (or "nesting index")
Running one RSpec example without line numbers avoids fragile file-position matches when specs change. Example ids, also called nesting indexes, target the example tree directly.
Ruby: How to use global variables for a conditional debugger
Global variables can temporarily gate a Ruby debugger, avoiding repeated stops in callbacks and specs when only one execution path matters.
How to write complex migrations in Rails
Complex Rails schema changes need SQL, embedded migration models, or adapter helpers when simple add_column and update calls cannot handle existing data safely.
Your browser might silently change setTimeout(f, 0) to setTimeout(f, 4)
Nested zero-delay timers are clamped by browsers, so repeated setTimeout(f, 0) calls can run several milliseconds late, especially in background tabs.
How to use Active Job to decouple your background processing from a gem
Background jobs in Rails can stay adapter-agnostic by using ActiveJob, making Sidekiq or Resque easy to swap without changing worker code.
Enumerators in Ruby
Ruby each methods can return an enumerator when no block is given, enabling lazy iteration, chaining, and pagination-friendly data fetching.
Disable text-transforms in Selenium tests
text-transform: uppercase can make Selenium assertions flaky and break umlaut handling; disabling transforms in tests improves reliable label text matching.
Henning's skills for a basic software development lifecycle
Agent skills for taking software requirements from exploration to deployment with minimal context switching and clear handoffs between planning, implementation, and review.
Using the ActiveSupport::BroadcastLogger
ActiveSupport::BroadcastLogger sends one log message to multiple outputs, useful for writing Rails and Sidekiq logs to both STDOUT and files.
Git diff: Deemphasizing code that was only moved around
Long diffs can hide real edits inside large code moves; git diff --color-moved=dimmed-zebra dims unchanged moved lines and highlights changes.
Speed up large Cucumber test suites
Large Cucumber suites can become slow as they grow; deferring garbage collection during scenarios can noticeably reduce overall execution time.
A simple example with a GIN index in Rails for optimizing a ILIKE query
ILIKE searches in PostgreSQL can be slow without trigram indexing; a GIN index with pg_trgm can replace sequential scans with bitmap index scans.
Integrating or upgrading makandra-rubocop
Integrating makandra-rubocop into an existing Ruby codebase often means handling many current offenses, then fixing cops incrementally without blocking development.
RSpec: Applying stubs only within a block
RSpec mocks normally persist for a spec; RSpec::Mocks.with_temporary_scope limits temporary stubs to a block and releases them afterward.
PostgreSQL: Be careful when creating records with specific ids
Manually assigning primary keys in PostgreSQL can leave sequences unchanged, causing duplicate-key errors on the next insert. Resetting the sequence prevents conflicts.
Always convert and strip user-provided images to sRGB
User-uploaded images can lose correct colors if metadata is stripped before color conversion. Converting to sRGB and reattaching the profile keeps browser rendering consistent.
Ruby: Referencing global variables with the built-in English library
Ruby’s special global variables are harder to read and can fail without require 'English', especially in Rails where the library is not loaded by default.
A nicer way to run RSpec and/or Cucumber
Convenience scripts streamline RSpec and Cucumber runs with bundle exec, parallel execution, spinner support, and a full test check against regressions.
Ruby: How to make your ruby library configurable
Configuring a Ruby library via a block makes endpoints and similar settings easy to override without hardcoding values.
JavaScript: Sharing content with the native share dialog
Native share dialogs on mobile and desktop let users hand off links, text, and titles to installed apps; navigator.share works only on HTTPS pages.
How to hide your selenium browser window with "headless"
Selenium browser windows can steal focus during Cucumber acceptance tests; headless with xvfb keeps them hidden while running Selenium WebDriver through Capybara.
Opt out of selenium manager's telemetry
selenium-webdriver can send hourly usage stats during browser feature specs; setting SE_AVOID_STATS=true disables the telemetry call.
Advanced plotting in Ruby with Gnuplot
Complex plots in Ruby often need direct access to Gnuplot syntax for histograms, boxplots, and multi-column data. Ruby wrappers differ in how much file handling and array support they hide.