Capybara: Running tests with headless Chrome

Running Capybara system tests in Chrome without a visible window reduces CI friction and supports Docker, device emulation, PDF handling, and remote debugging.

Heads up: RSpec-Mocks' #stub_const will define intermediate modules that have not been loaded yet

stub_const can create an unloaded intermediate module and break tests with unexpected method errors. Using the class constant in the path lets Rails autoload the class first.

Capybara: Testing file downloads

File downloads are awkward to verify with Selenium because browsers may prompt, auto-save, or render binaries instead of HTML. Alternative approaches use request specs, Rack::Test, or the browser download folder.

How to: Use git bisect to find bugs and regressions

Binary search through commits isolates the first bad revision that introduced a bug or regression, with git bisect and optional automated tests.

Manipulate color with Sass functions

Built-in Sass color functions adjust hue, brightness, saturation, grayscale, complements, and inverses for stylesheet theming and palette tuning.

Ruby: What extend and include do

Module mixins in Ruby can be confusing: include and extend affect method availability through the class and singleton class, not just instance versus class methods.

How to organize monkey patches in Ruby on Rails projects

Rails projects accumulate small monkey patches for gems and core classes; grouping them under lib/ext by gem or namespace keeps config/initializers tidy and loading predictable.

Traverse an ActiveRecord relation along an association

traverse_association pivots an ActiveRecord relation through associations to reach related records efficiently, using IN (...) queries for large key sets.

Baseline npm security

Compromised npm packages are increasingly used for supply-chain attacks and malware. Cooldown windows, blocked git subdependencies, disabled scripts, and safer npx usage reduce exposure.

The many gotchas of Ruby class variables

Ruby class variables are shared across inheritance hierarchies and bind to the current scope at parse time, making them hard to control and easy to misuse.

Ruby: __FILE__, __dir__ and symlinks

Symlinked Ruby scripts can break relative path loading because __FILE__ points to the link path. __dir__ or File.realpath(__FILE__) keeps library paths correct.

Git: How to view a file from another branch

Access a file version from a different Git branch without checking it out, using git show with branch and path syntax.

Rails: Concurrency-safe API request counting with `upsert`

Lost updates make Ruby-side counter increments unsafe under concurrent API traffic; a Postgres upsert with a unique index performs atomic request counting.

Rails: Use fixture helpers like `users(:alice)` in the Rails console

Rails console fixture lookups are awkward when only fixture names are known; a small initializer adds users(:alice)-style helpers for loaded fixture records.

Rails: Restrict deletion of a parent record using scoped associations

Block parent deletion when specific child-record conditions exist by combining scoped has_many associations with dependent: :restrict_with_error and ordered callbacks.

Rules of thumb against flaky specs

Flaky specs often come from brittle matchers, nondeterministic record limits, and UI components that load or animate asynchronously.

Rails: Composing an ETag from multiple records

fresh_when can combine multiple records into one ETag so associated data keeps cached pages invalidated when any rendered record changes.

Unpoly 3.14.1, 3.14.2 and 3.14.3 released

Maintenance releases for Unpoly 3.14.1–3.14.3 add preserved viewport scroll positions, :has() support with Unpoly suffixes, and source maps in the npm package.

An introduction to Hybrid search

Hybrid search combines vector retrieval and BM25 keyword search to catch paraphrases and exact terms, improving recall when either method alone misses relevant documents.

How to disable irb's welcome banner or how to enable it for the Rails console

irb 1.18.0 adds a startup banner with version and hint information; it can be hidden or enabled in the Rails console through ~/.irbrc.

Ollama: Structured Input and Output

Reliable LLM integrations need prompts and parsers that keep retrieved context separate, constrain output shape, and recover from preambles, extra fields, or invalid JSON.

Printing background color of elements

Printed pages often drop background colors, which breaks charts and other colored elements. print-color-adjust: exact keeps backgrounds and preserves white text legibility.

Dynamic super-overridable methods in Ruby – The Pug Automatic

Ruby metaprogramming can generate methods that remain super-able inside the same class or trait, enabling reusable modular behavior.

Shorthand function properties in ES6

ES6 object literals support concise method syntax and inline getters, replacing verbose function properties and Object.defineProperty() for simple computed values.