How to apply transparency to any color with pure CSS
CSS can create a transparent variant of any color without preprocessor support, using color-mix() or relative color syntax for borders, backgrounds, and other components.
How to invert currentColor with pure CSS
Modern CSS can derive an inverse from currentColor with hsl(from ...), rotating hue and flipping lightness for contrasting effects.
Selecting the nth element matching a selector
CSS Level 4 :nth-child(of ...) targets the nth sibling matching a selector, enabling pure-CSS selection by class or other filter instead of element type.
The developer console can do more than you think!
Browser developer tools offer richer logging than console.log, including tables, grouped output, timers, clickable object links, and stack traces for debugging.
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.
Capybara: Preventing server errors from failing your test
Capybara can fail tests after all steps when the Rails server raises an error on session cleanup. Filtering known missing-file errors avoids false failures.
Fuzzy scoping in Rails with PostgreSQL
Approximate string filtering in Rails can find names that nearly match a term by using PostgreSQL trigram similarity and a tunable threshold.
Git Rebase: How to squash/fixup/edit/... commits without actually rebasing (keeping the base)
Clean up commits on a long-lived feature branch without changing its base, then later rebase one polished commit onto main.
Prevent unnecessary automated back-and-forth when sending noreply-emails
Automated messages from a noreply@ address can trigger out-of-office replies and error bounces. Setting Auto-Submitted: auto-generated suppresses the unwanted back-and-forth.
Sidekiq: How to check the maximum client Redis database size
Sidekiq queues can fill Redis memory quickly; checking maxmemory_human reveals the database limit, and job payload size determines how much capacity remains.
How to fill in multiple lines in a textarea with cucumber
Multi-line textarea input in Cucumber needs docstrings for text with line breaks and paragraphs; the spreewald gem provides the step definition.
How to use a local gem in your Gemfile
Use a local gem copy in Gemfile to test code changes immediately and debug or modify the gem without publishing. Avoid committing local paths because they break for other developers.
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.
Testing Accessibility using Orca
Linux screen reader testing can be noisy and hard to inspect; capturing Orca speech in real time makes spoken output readable during accessibility checks.
Rails: Configuring the default sorting behaviour
Default ordering in ActiveRecord queries falls back to id unless implicit_order_column is set, which can make first and other finder calls return a different record order.
Efficiently add an event listener to many elements
Attaching one listener to many elements can slow the browser; delegating to document reduces setup cost and suits low-frequency events like click.
How to grep through the DOM using the Capybara API
Capybara can search page HTML in Ruby when CSS or XPath is awkward, but DOM changes can cause stale element errors.
Capybara: Accessing the parent of an element
Capybara can move from a selected node to its parent with find(:xpath, '..'), useful for checking surrounding links or containers in tests.
How to set Chrome's time zone in Selenium tests
Chrome time-dependent behavior in Selenium tests can require a different browser timezone than the host system. Emulation.setTimezoneOverride changes it for the whole session and must be reset afterward.
Rails: Keeping structure.sql stable between developers
db/structure.sql can vary between developers because database or CLI tool versions differ, creating noisy diffs and merge conflicts in Rails projects.
Implementing upload progress and remove button with ActiveStorage DirectUpload
In-place file uploads with ActiveStorage DirectUpload can show progress and support removing a chosen file before form submission.
A "text-wrap: balance" fallback approach
Fallback rendering for text-wrap: balance when browser support is missing, using explicit line breaks for older Safari and hiding them when balancing is available.
Implementing authentication and authorization for ActiveStorage blobs/files
Rails ActiveStorage direct uploads are public by default, so unauthenticated users can flood storage and access sensitive blobs without ownership checks.
Rails: Preloading associations in loaded records
Preloading nested associations on already loaded ActiveRecord objects avoids extra queries when rendering deeply related data and fits legacy Rails models via preload_associations.