Let the browser choose the protocol
Protocol-dependent links break mixed-content embeds and tests; protocol-relative URLs let the browser pick http or https from the page context.
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.
Running "bundle update" will update all gems without constraints
bundle update without arguments refreshes every gem and can break an app; updating gems regularly and conservatively reduces risky dependency changes.
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.
Preventing users from uploading malicious content
Uploaded HTML or SVG can execute JavaScript and steal session cookies; safer uploads rely on extension allowlists, strict CSP, attachment disposition, or octet-stream delivery.
Checklist for Implementing Design
Design changes need more than visual parity: implementations should be tested, responsive, touch-friendly, accessible, localized, and consistent with existing patterns.
How to: A thorough i18n completeness check in CI (Rails + i18n-tasks)
Rails i18n completeness can drift across tiers and locales; CI with i18n-tasks catches missing, unused, inconsistent, and normalized translation files.
An introduction to Hybrid search
Hybrid search combines vector retrieval and BM25 keyword search to catch paraphrases and exact terms, improving recall when either method alone misses relevant documents.
Optimizing images for LLM inference
Reducing image size and trimming whitespace lowers vision-token cost while keeping text readable; OCR-based strip slicing can keep dense pages within context limits.
How to define a table prefix for all Rails models in a namespace
Rails namespaces can produce doubled table prefixes when table_name_prefix is set on individual models. Defining it on the namespace module keeps nested model table names correct.
Devise: Don't forget to lock users with soft delete
Soft-deleted users can stay authenticated in Devise unless account activity checks are tied to the trash state. Customizing active_for_authentication? blocks sign-in and protects password reset flows.
Heads up: Quering array columns only matches equally sorted arrays
PostgreSQL array queries in Rails match element order, so [16, 17] and [17, 16] are different. Order-independent matching needs normalization or bidirectional containment.
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.
How to write modular code
Reduce spaghetti code by splitting behavior into focused functions, service classes, form models, and value objects, while avoiding long parameter lists and excessive DRY.
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.
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.
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.
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.
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.
Don't use migrations to seed default data
Seeding rows in a Rails migration breaks tests that expect an empty database and creates maintenance pain. Use db/seed.rb or a script in lib/scripts for default application data.
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.
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.
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 get notified when Claude Code needs your input
Desktop notifications can alert you when Claude Code pauses for permission or user input, and a click can reopen the right project in your IDE.