Using Capybara finder methods with arbitrary matching conditions

Capybara matchers and finders can take a Ruby block for extra DOM conditions when built-in options are not enough. Script calls inside filter blocks need a temporary wait time to avoid Selenium timeouts.

Project management best practices: Technical debt summary

Prioritizing refactoring and upgrade work is harder in larger projects; a maintained technical-debt summary helps compare effort, customer value, and developer value.

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.

Rails: Your index actions probably want strict_loading

Strict loading in index actions catches N+1 queries when views touch unpreloaded associations, causing test failures instead of hidden database hits.

Using partials in Rails views

Rails partials support locals, yield, layouts, collections, empty states, controller rendering, and cached collection rendering for reusable view markup.

HTTP headers can only transport US-ASCII characters safely

HTTP header values are limited to low-ASCII for safe transport; non-ASCII data such as Umlauts or emojis can be carried by JSON-escaping characters above 127.

How to reliably center icons vertically with text

Icons and other inline blocks can be centered against capital letters instead of the text baseline. vertical-align with font metrics or 1lh gives a reliable result.

Timecop: reset after each test

Frozen time in tests can make suites flaky when state leaks between examples. Resetting Timecop after each test or using block form prevents order-dependent failures.

Jasmine: Mocking ESM imports

Imported ESM functions are hard to spy on in Jasmine; several workarounds keep call counts testable, including wrapper objects, dependency injection, and test runners with module mocking.

Heads up: network requests `Kernel#open` are not mocked with VCR

Kernel#open and OpenURI#open_uri can still trigger real network requests in tests because VCR and WebMock do not mock them.

subscript, superscript and line-heights

<sub> and <sup> often break line height in email layouts; setting line-height: 0 with mso-line-height-rule: exactly keeps superscripts and subscripts consistent across clients.

A modern approach to SVG icons

SVG icons can be sized and colored like text without image tags, icon fonts, or extra server work by using CSS masking.

Jasmine: Creating DOM elements efficiently

Efficient ways to create DOM test fixtures for Jasmine, from HTML parsing and selector helpers to innerHTML, with readable structure and direct element references.

Jasmine: Cleaning up the DOM after each test

DOM-based Jasmine specs can leak leftover elements into later tests; using a dedicated fixture container cleared after each run keeps test state isolated.

Careful when using Time objects for generating ETags

Time values in ETag generation can lose millisecond precision, causing stale cache hits and flaky tests. Convert them to strings or numbers before combining cache keys.

Rules of thumb against flaky specs

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

Git: Restore

git restore reverses staged, unstaged, deleted, or conflicted changes with clearer intent than git checkout, and can restore files from other revisions.

Git commands to discard local changes

Removing local Git modifications is useful when work needs to be undone, parked temporarily, or cleaned from tracked and untracked files without affecting remote history.

RubyMine: Find and Replace with Regex (Capture Groups and Backreferences)

Regex find-and-replace in RubyMine uses capture groups and backreferences to rewrite quoted text, URLs, and old RSpec syntax safely.

Careful: `fresh_when last_modified: ...` without an object does not generate an E-Tag

Passing last_modified without an object skips ETag generation, so second-level timestamps can make distinct responses look identical and break cache-related tests.

JSON APIs: Default design for common features

JSON API design benefits from established conventions for attributes, pagination, errors, and related objects, making client integration more predictable.

Git: Removing feature branches on merge

Feature branches accumulate after merges; a post-merge Git hook can prompt for cleanup and remove the merged branch locally and on the remote.

How to debug file system access in a Rails application

Rails apps can make hidden file checks that slow requests, especially on networked storage. strace reveals unnecessary stat calls and other system calls.

Gem development: recommended gem metadata

Gem metadata can add source, bug tracker, changelog and MFA links to the RubyGems page, improving discoverability and security signals.