A simpler default controller implementation
Rails controllers can stay short, testable and authorization-friendly by using a minimal shared blueprint for CRUD, strong params, scopes and optional HTTP caching.
Use <input type="number"> for numeric form fields
Numeric form fields on mobile get digit-focused keyboards, locale-aware decimal display, and consistent point-based values in JavaScript and form submission.
Heads up: Byebug has problems with zeitwerk
Byebug 11.1.3 can trigger NameError with Rails 6 zeitwerk autoloading; binding.pry, eager loading, or another debugger avoid the issue.
Rails: Example on how to extract domain independent code from the `app/models` folder to the `lib/` folder
Move API-client code out of app/models into lib/ to separate domain logic from reusable infrastructure and keep Rails code more maintainable.
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.
ActiveRecord: When aggregating nested children, always exclude children marked for destruction
Nested form deletions can inflate aggregated totals when child records marked for removal are still counted. marked_for_destruction? filters them out before saving.
Geordi: Running Selenium tests in a VNC buffer
Selenium browser windows can run inside a VNC buffer instead of appearing on the desktop, while still allowing inspection when needed.
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.
CSP: Nonces are propagated to imports
Module scripts with a nonce automatically pass that trust to dynamic import(), enabling chunk loading under restrictive CSP without strict-dynamic.
How to update a single gem conservatively
Updating one gem with bundle update can pull in dependency upgrades and break existing code. Bundler --conservative limits changes to the targeted gem and avoids unnecessary transitive updates.
How to disable Chrome's save password bubble for Selenium tests
Chrome’s password-save bubble can clutter Selenium debugging when forms trigger credential prompts. Disabling the password manager via profile prefs or using Incognito suppresses it.
Installing multiple MySQL versions on the same Linux with mysql-sandbox
Run several MySQL releases side by side in one Linux account for testing or Rails development, using isolated sandboxes on separate ports.
How to get notified when Claude Code needs your input
Desktop notifications for Claude Code prevent missed prompts when the agent pauses for input; clicking the alert can reopen the project in your IDE.
E-mail deliverability
High-volume transactional email often gets blocked by spam filters and denylist issues, making reliable delivery hard even with standard SMTP relays.
Limiting GitLab CI runner to specific branches or events
Control when CI jobs run by matching branches, merge requests, and other pipeline conditions with rules; rules replaces only and except in GitLab 12.3+.
Spreewald, Cucumber: Selector for the nth Element
Custom Cucumber selectors in Spreewald make it easy to target repeated form fields by ordinal position, but :nth-of-type can break when surrounding HTML changes.
Capybara: Quick checking for element presence (without retries or timeout)
Capybara presence checks can wait for seconds or raise on find; has_css? with wait: 0 returns immediately for quick boolean checks.
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.
Selenium may break with ChromeDriver 75+
ChromeDriver 75+ can trigger W3C errors in Selenium tests, and browser log access may fail. Disabling w3c in Chrome options restores the older behavior.
How to evaluate CSS media queries in JavaScript
Responsive breakpoints can be checked in JavaScript with matchMedia() instead of duplicating CSS logic, and MediaQueryList change events track width updates efficiently.
Let a Rails 3 application make a request to itself
Rails 3 can issue internal HTTP requests through the Rack interface, useful for Cucumber features and testing app responses without a browser.
whenever: Installing cron jobs only for a given Rails environment or Capistrano stage
Conditional cron jobs in whenever can target only one Rails environment or Capistrano stage, avoiding unwanted tasks on other deployments.
How to stub class constants in RSpec
RSpec cannot stub constants directly; using attributes, wrapper methods, or test helpers makes constant-dependent code easier to isolate.
Test a download's filename with Cucumber
Verify that a server response suggests the expected download name in a Cucumber scenario, using Capybara or Webrat to check the Content-Disposition header.