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.
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.