Better numeric inputs in desktop browsers
Desktop number fields accept scientific notation, arrow-key changes, wheel scrolling, and stray letters, causing accidental edits and validation errors.
Action Mailer Previews
Previewing Rails emails in the browser catches layout and content issues before delivery and helps keep mailer output aligned with expectations.
Concurrency issues with find-as-you-type boxes
Live search boxes can show stale results when AJAX responses arrive out of order, causing flashing and mismatched suggestions. Serializing requests or discarding outdated responses avoids the race condition.
Include keystrokes in a screencast
Show pressed keys on screen for screencasts or screen sharing with screenkey, and adjust the overlay through its settings window.
Best practices: Writing a Rails script (and how to test it)
Rails one-off scripts need idempotence, transactions, transparency, and robust error handling; isolating logic from input also makes them testable.
Accessing JavaScript objects from Capybara/Selenium
Capybara and Selenium can access only browser globals, so exported JavaScript modules fail in evaluate_script unless the component instance is attached to the element.
Git shortcut to fixup a recent commit
git commit --fixup needs a target commit SHA, making fixup commits awkward to create; an fzf alias can select the commit interactively before git rebase -i --autosquash.
When reading model columns during class definition, you must handle a missing/empty database
Class definition code that inspects model columns can crash startup when the database is missing or empty, blocking db:create and db:migrate.
Bash: How to count and sort requests by IP from the access logs
Count and sort request frequencies by client IP in access logs with a short awk pipeline for quick traffic checks and abuse spotting.
Bash: How to grep logs for a pattern and expand it to the full request
Find all Rails log lines for matching requests by extracting request IDs and re-grepping the full log, avoiding interwoven output from concurrent requests.
Rails: Testing the number of database queries
N+1 queries and excessive eager loading can be caught by asserting exact database query counts in specs with the make_database_queries RSpec matcher.
Opening a zipped coverage report with one click
Make zipped coverage reports open directly in a browser from the file manager, with a fallback to the normal archive opener for other .zip files.
Element.animate() to animate single elements with given keyframes
Animate HTML elements with Element.animate() from the Web Animations API; control timing, playback state, and completion without extra libraries.
SASS: Adding, removing and converting units
Sass unit arithmetic makes it easy to attach, strip, and convert measurement units when working with CSS values and timing data.
When loading Yaml contents in Ruby, use the :freeze argument to deep-freeze everything
YAML.safe_load and YAML.safe_load_file can deep-freeze parsed YAML with freeze: true, keeping configuration data fully immutable; ... .freeze leaves nested objects mutable.
Creating a self-signed certificate for local HTTPS development
Local HTTPS development often needs a trusted certificate for browser access. Self-signed or CA-signed certificates let localhost or wildcard hostnames run without warning dialogs.
How to search through logs on staging or production environments
Finding a request in staging or production logs often requires searching several servers and archived files; grep or zgrep can query current and zipped logs.
How to make your application assets cachable in Rails
Rails asset URLs need fingerprints or timestamps to let browsers cache images, stylesheets, and scripts long-term without serving stale files after updates.
How to let passenger restart after deployment with capistrano
Phusion Passenger restart handling after deploy is version-dependent; capistrano-passenger picks the correct restart command automatically and hooks into Capistrano.
Maintaining custom application tasks in Rails
Large Rails projects benefit from keeping application tasks slim, separating the executable wrapper from the business code, and testing both rake tasks and scripts.
Unpoly 3.7.1, 3.7.2 and 3.7.3 released
Bug fixes for Unpoly 3.7.1–3.7.3 address lost form input, validation race conditions, autosubmit regressions, and fragment targeting issues in complex asynchronous flows.
CSS: Letting text flow around a round element
Wrap text around a circular element by floating it and using shape-outside with content-box; matching shape-margin to the element margin keeps spacing consistent.
Cucumber step to match table rows with Capybara
Cucumber step for checking table rows in Capybara, with optional exact matching, row order control, wildcards, and support for colspan or rowspan tables.
Pitfall: ActiveRecord callbacks: Method call with multiple conditions
Conditional after_save callbacks can silently lose earlier :if conditions when the same method is registered twice. Combine predicates or move the logic into the callback.