Capybara: Find an element that contains a string
Capybara can locate DOM nodes by text content using text: with a selector or regular expression, avoiding unsupported CSS string-matching selectors.
Git: Show commits that have touched specific text in a file
Find Git commits that changed a specific line or text in a file using git log -G; tig offers a navigable view of matching changes.
How Rails chooses error pages (404, 500, ...) for exceptions
Rails maps unhandled exceptions to HTTP status codes and error pages via action_dispatch.rescue_responses, and custom classes can be treated as 404 or 500 responses.
Case sensitivity in PostgreSQL
PostgreSQL compares strings case-sensitively, which can break email and username lookups and uniqueness checks. Lowercasing values or using case-insensitive matching avoids common bugs.
JavaScript: Stopping expensive work in inactive tabs
Pause expensive periodic work when a tab is hidden to save battery and mobile data; document.hidden and visibilitychange let background pages go passive.
How to find out what is running on a port on a remote machine
Remote ports can hide unexpected services, and nmap can identify the daemon and version behind a TCP port. Useful when a server exposes the wrong service or response.
Building web applications: Beyond the happy path
Web apps fail on devices, browsers, slow networks, large data, and printing when responsive design, loading states, image handling, and metadata are neglected.
How to force horizontal panel layout for Chrome
Chrome DevTools can switch between vertical and horizontal panel layouts based on width, making deep DOM trees hard to inspect. The panel layout setting forces a preferred orientation.
How to organize monkey patches in Ruby on Rails projects
Rails projects accumulate small monkey patches for gems and core classes; grouping them under lib/ext by gem or namespace keeps config/initializers tidy and loading predictable.
How to Work With Time Zones in Rails
Rails uses configurable time zones, while Ruby time APIs follow the server zone and can return wrong results. Time.zone keeps date and time handling consistent.
RSpec Argument Matchers: Expecting non-primitive objects as method invocation arguments
RSpec can verify method arguments that are objects by class, interface, attributes, equality, or custom block checks instead of simple primitive values.
Stretching an HTML page to full height
html and body default to content height, so absolutely positioned footer elements may miss the viewport bottom; min-height: 100% or 100vh keeps pages full height.
Heads up: RSpec's diffs may not tell the truth
RSpec diffs can mislead when matchers print like failures or when Time.now values differ only by milliseconds.
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.
Rails route namespacing (in different flavors)
Rails routes can separate URL segments, helper names, and controller modules, letting you namespace controllers or change paths without affecting the other dimensions.
Testing ActiveRecord callbacks with RSpec
Database-backed RSpec checks for ActiveRecord lifecycle behavior are more reliable than stubs when verifying side effects like automatically creating associated records.
Testing ActiveRecord validations with RSpec
Rails model validation tests can be written directly with record.validate and error checks, or shortened with shoulda-matchers for standard cases.
RSpec 3 argument constraints use weak equality
RSpec 3 argument matching can accept broader values than strict equality, especially for classes, regexps, and ranges. Use eq or a block for exact expectations.
HTTP 302 redirects for PATCH or DELETE will not redirect with GET
Browsers may keep PATCH and DELETE on 302 redirects instead of switching to GET, breaking AJAX flows. Use 303 See Other or POST method override to force a GET follow-up.
Make Nokogiri use system libxml2
Nokogiri can be built against system libxml2 instead of bundled binaries, reducing rebuild work after security updates and aligning installs with patched OS libraries.
Defining and calling lambdas or procs (Ruby)
Ruby Proc objects can behave as strict lambdas or flexible blocks, affecting argument handling and return behavior when code is wrapped as callable objects.
Keeping web applications fast
Fast web apps avoid unnecessary database work, oversized assets, and heavy client-side rendering, while measuring bottlenecks before optimizing caches, scripts, images, or page delivery.
Enumerators in Ruby
Ruby each methods can return an enumerator when no block is given, enabling lazy iteration, chaining, and pagination-friendly data fetching.
Escape a string for transportation in a URL
Safely transporting arbitrary text in URLs requires percent-encoding reserved characters like & and =; Rails helpers do this automatically, while manual URLs need CGI.escape or encodeURIComponent.