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.

Generating an Entity Relationship Diagram for your Rails application

Rails apps can generate entity relationship diagrams to visualize model dependencies and export them as images or PDF. rails-erd also supports limiting the diagram to selected models.

Handling NULL values in SQL comparison logic

NULL values break ordinary equality and negation checks in SQL, so rows can disappear unless queries handle unknowns explicitly with IS NULL, IS DISTINCT FROM, or COALESCE.

Deployment: Merge consecutive commits without cherry-picking

Skip unready commits during deployment by merging an earlier commit reference instead of cherry-picking, avoiding duplicate history entries later.

Using ngrok for exposing your development server to the internet

Temporary public access to a localhost development server is useful for testing on another device or through TLS without port forwarding or self-signed certificates.

Logic of `where.not` with multiple attributes

where.not with multiple hash attributes uses NAND logic, excluding only records that match all conditions; chained calls behave like NOR and exclude matches to any condition.

RSpec: Defining negated matchers

RSpec::Matchers.define_negated_matcher creates readable inverse matchers for composed expectations and clearer failure messages, but only for atomic matchers with unambiguous negation.

Caching in Rails < 6.1 may down parts of your application when using public cache control

Public cache control can serve the wrong MIME type and enable cache poisoning when responses vary by Accept; Vary: Accept prevents stale or mismatched cached content.

ES6 imports are hoisted to the top

ES modules are hoisted, so import order in source can differ from execution order and break code that depends on globals like $.

Ensure passing Jasmine specs from your Ruby E2E tests

Run Jasmine specs through Rails E2E tests to catch JavaScript failures in regular test runs and verify the runner finishes with all specs passing.

Using feature flags to stabilize flaky E2E tests

Always-on UI behaviors like polling, animations, autocomplete, and lazy loading can make E2E tests flaky; feature flags disable them by default and re-enable them only where needed.

RSpec: automatic creation of VCR cassettes

RSpec examples tagged :vcr automatically record and replay HTTP cassettes, while untagged specs block network calls unless HTTP access is explicitly enabled.

Better numeric inputs in desktop browsers

Desktop number fields accept scientific notation, arrow-key changes, wheel scrolling, and stray letters, causing accidental edits and validation errors.

Event delegation (without jQuery)

Single-listener event handling can cut setup cost and support dynamically added elements, but it can slow fast events and limits bubbling control.

Capybara can find links and fields by their [aria-label]

Capybara can locate form fields and links by aria-label, improving accessibility-aware test selectors when visible labels are missing.

Git shortcut to fixup a recent commit

git commit --fixup needs a target commit SHA, making fixup commits awkward to create; an fzf alias can select the commit interactively before git rebase -i --autosquash.