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.

Rails developers: Have better context in Git diffs

Git can show the wrong surrounding code in Ruby diffs unless file types are mapped to better hunk headers. Custom diff drivers and xfuncname improve context for Rails, RSpec, and Cucumber files.

Ensure deterministic ordering of records

Records created close together can share the same timestamp, making timestamp-only sorting unstable. Adding the primary key as a final order condition keeps list ordering deterministic.

Using PostgreSQL ranges with ActiveRecord

PostgreSQL range types store date and time intervals in one column and fit ActiveRecord casting, overlap queries, and exclusion constraints for booking data.

TypeScript: Enable strict-boolean-expressions for Safe Nullish Checks

Falsy values can make && and || null checks unsafe in TypeScript; ??, optional chaining, and strict-boolean-expressions prevent silent bugs.

Ruby: How to use prepend for cleaner monkey patches

prepend makes Ruby monkey patches cleaner by inserting an extension before the original implementation, so super still reaches it and ancestor chains stay readable.

Defining new elements for your HTML document

Custom elements let you create semantic HTML components that browsers render normally and activate directly with customElements.define(), avoiding framework-specific compilation.

How to reload a belongs_to association

Reload a single-record Rails association without reloading the whole parent object; Rails 5+ uses reload_<association>, older versions accept association(true).

Locally testing a website on its real domain

Use a real production domain in local development for testing embeds, cookie banners, and other domain-allowlisted integrations by mapping it to localhost with HTTPS.

TypeScript: Get in Shape with Structural Typing

TypeScript uses structural typing and strict checks for fresh object literals, union types, type assertions, satisfies, and narrowing to prevent runtime errors.

RSpec: Debug flickering test suites with rspec --bisect

Randomized RSpec order can expose order-dependent failures that pass alone but fail in full runs; rspec --bisect finds a minimal reproducer for the offending interaction.

Passive event listeners may speed up your scroll and touch events

Passive listeners let the browser keep scrolling responsive by not waiting for touch or wheel handlers that never cancel default behavior.

Linux: Open a file with the default application

Open files from the Linux shell with the configured default app using xdg-open; per-MIME defaults can be queried or changed with xdg-mime and mimeopen.

RSpec: How to retry examples

Flaky RSpec examples can be retried a limited number of times in CI instead of failing immediately, using rspec-rebound with configurable retry settings.

Git: Improve your commits by reviewing changes one-by-one

Git commits become safer when changes are reviewed and staged in small hunks, reducing accidental additions before committing.

Heads up: JavaScript does not like big numbers

JavaScript numbers lose precision above Number.MAX_SAFE_INTEGER, because values are stored as double-precision floats. BigInt handles arbitrary large integers.

CSS: The inset CSS shorthand

inset is a shorthand for top, right, bottom, and left, matching margin-style multi-value syntax for absolute positioning.

How to simulate limited bandwidth in Google Chrome and Firefox

Slow network conditions can be reproduced for web app testing with browser devtools or trickle, revealing issues on mobile and other constrained connections.

Ruby object equality

Ruby equality methods differ by purpose: == for value comparison, eql? and hash for hash keys, === for case matching, equal? for identity.

ActiveRecord: Cleaning up your database with ignored_colums

Unused database columns confuse teams and can linger safely while legacy access is phased out. ignored_columns removes Rails accessors and helps flag fields for later removal.

Debugging failed AJAX requests with better_errors

better_errors adds enhanced development error pages with a live REPL, and /__better_errors lets you inspect exceptions from AJAX requests.

Using partials in Rails views

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

Preloaded associations are filtered by conditions on the same table

Eager loading can unintentionally narrow has_many results when a where condition targets the joined table, even if the filter was only meant for the parent model.

Rails: namespacing models with table_name_prefix instead of table_name

Rails namespaces can share a table name prefix, avoiding repeated self.table_name settings for each model and keeping nested models aligned with naming conventions.