Self-expiring URLs with Apache

Signed URLs for private uploads can expire without routing downloads through Rails, improving speed while reducing the risk of permanent access.

Jasmine: Testing AJAX calls that manipulate the DOM

AJAX DOM updates are hard to test when requests are asynchronous and the target element is missing. jasmine-ajax, jasmine-fixture, and done make network mocking and DOM setup possible.

Jasmine: Mocking ESM imports

Imported ESM functions are hard to spy on in Jasmine; several workarounds keep call counts testable, including wrapper objects, dependency injection, and test runners with module mocking.

Capistrano: Less deploy output, better overview

Capistrano deploys are noisy by default; a custom formatter reduces console clutter while keeping errors visible and the full log in log/capistrano.log.

Updated: How to apply transparency to any color with pure CSS

Pure CSS can make any color transparent without extra assets or scripting, including a variant using Relative Color Syntax.

SVGO: SVG Optimizer

SVG files often contain comments, metadata, and hidden elements that inflate size. SVGO reduces them while preserving proper scaling with viewBox.

Capybara can find links and fields by their [aria-label]

Capybara can locate form fields and links by aria-label, improving accessibility-aware test selectors when visible labels are missing.

Rails: Do not load frameworks you don't need

Loading every Rails framework increases startup time and memory use; disabling unused railties and gems keeps apps lighter and avoids unnecessary configuration.

Using path aliases in esbuild

Use path aliases to replace clunky relative imports with stable module shortcuts in esbuild, and wire those aliases into webpack, jest, Sass, and glob imports.

Carrierwave: Custom file validations inside custom Uploaders

MIME type checks can live in a CarrierWave uploader instead of every mounted model, keeping file-type validation centralized and raising CarrierWave::IntegrityError for bad uploads.

ActiveRecord::Relation#merge overwrites existing conditions on the same column!

ActiveRecord::Relation#merge can overwrite conditions on the same column and return too many records; where, subselects, and, or SQL snippets preserve the intersection.

Updated: Rails: Restrict deletion of a parent record using scoped associations

Scoped associations can block parent deletion when dependent records should remain valid; a cleaner callback setup and an example clarify the restriction.

Emulating contrast-color with pure CSS

Pure CSS can emulate contrast-color for older browsers using Relative Color Syntax and modern color spaces, producing automatic black-or-white text from the background.

Verifying doubles in RSpec 3

Safer test doubles in RSpec 3 verify stubbed methods and argument counts, catching interface mismatches while keeping isolated specs fast.

Capybara: Running tests with headless Chrome

Running Capybara system tests in Chrome without a visible window reduces CI friction and supports Docker, device emulation, PDF handling, and remote debugging.

Heads up: RSpec-Mocks' #stub_const will define intermediate modules that have not been loaded yet

stub_const can create an unloaded intermediate module and break tests with unexpected method errors. Using the class constant in the path lets Rails autoload the class first.

Capybara: Testing file downloads

File downloads are awkward to verify with Selenium because browsers may prompt, auto-save, or render binaries instead of HTML. Alternative approaches use request specs, Rack::Test, or the browser download folder.

How to: Use git bisect to find bugs and regressions

Binary search through commits isolates the first bad revision that introduced a bug or regression, with git bisect and optional automated tests.

Manipulate color with Sass functions

Built-in Sass color functions adjust hue, brightness, saturation, grayscale, complements, and inverses for stylesheet theming and palette tuning.

Ruby: What extend and include do

Module mixins in Ruby can be confusing: include and extend affect method availability through the class and singleton class, not just instance versus class methods.

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.

Traverse an ActiveRecord relation along an association

traverse_association pivots an ActiveRecord relation through associations to reach related records efficiently, using IN (...) queries for large key sets.

Baseline npm security

Compromised npm packages are increasingly used for supply-chain attacks and malware. Cooldown windows, blocked git subdependencies, disabled scripts, and safer npx usage reduce exposure.

The many gotchas of Ruby class variables

Ruby class variables are shared across inheritance hierarchies and bind to the current scope at parse time, making them hard to control and easy to misuse.