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.

Calling a helper method with the same name as your current partial

Partials create a local variable from their own name, which can shadow a helper method with the same name. Calling it with self. lets the helper method be used inside the template.

How to create giant memory leaks in AngularJS (and other client-side JavaScript)

AngularJS client-side code can steadily accumulate unreclaimed objects until the browser process crashes. Common causes include forgotten listeners, timers, plugins, scopes, and unbounded caches.

Bash functions to provide repository context for LLM chats

Bash functions package repository context and Git diffs into XML files for Gemini chats, reducing copy-paste friction and API usage.

HTTP Client in RubyMine

RubyMine’s built-in HTTP client tests web APIs from .http scratch files, supports sequential requests, and can reuse response data with JavaScript variables.

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.

CSS: Don't target multiple vendor-prefixed pseudo-elements in a single rule

Comma-separated selectors fail when one pseudo-element is unknown; vendor-prefixed and standard forms must be written as separate CSS rules, or generated with a Sass mixin.

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.

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.

Knapsack: Rerun a flaky test locally

Reproduce a flaky CI spec locally by rerunning the same Knapsack shard with the same seed and test order.

Beware: Many browsers define window.event

Some browsers expose window.event, but Firefox and recent IE versions do not. Passing the handler’s event object avoids cross-browser failures and accidental global access.

How to split up a git commit

Split one Git commit into several smaller commits by pausing an interactive rebase, undoing the commit, and recommitting selected changes.

How to explain SQL statements via ActiveRecord

ActiveRecord explain exposes database query plans for a scope, including joined or eager-loaded queries, in the database's native EXPLAIN format.

Always disable autocomplete for date pickers

Browser autofill can cover date picker popups and make them unusable. Disabling autocomplete on the trigger input keeps the calendar visible while preserving fallback behavior.

Canceling event propagation

Event propagation can be stopped in different ways, with distinct effects on default actions, bubbling, and handlers on the same element. jQuery’s return false combines prevention and propagation stop.

Controlling how your website appears on social media feeds

Social network previews often pick the wrong title, image and description unless OpenGraph meta tags provide them; Facebook caches previews and may need manual refresh.

How to bulk-unwatch many repositories on Github

Opting out of notifications for many GitHub repositories is faster through the watching page than changing each repository individually.

Defining custom RSpec matchers

Custom RSpec matchers support reusable test assertions, chaining, block expectations, and complex matcher classes for domain-specific checks.

Your database tables should probably have timestamps

Missing created_at and updated_at columns make record history harder to trace and bug reports harder to investigate. Rails migrations can add and backfill timestamps for old tables.

Rubocop fails with undefined StringIO

RuboCop can crash with uninitialized constant ... StringIO and related socket reader errors when an old version misses a required stringio require. Upgrading fixes it.

Controlling the order of DOM event listeners

DOM event listeners run in registration order, so forcing a handler to fire first or last can require capture, delegation, or a related event.