Creating a Rails application in a single file
Running Rails in one file is useful for quick experiments, debugging bugs, or embedding an app in tests, but version and dependency drift can cause surprises.
Web development: Accepting a self-signed certificate in Google Chrome
Chrome can reject locally generated self-signed certificates and hide HTTPS even when they work. Importing the certificate or launching with --ignore-certificate-errors allows testing.
Working with or without time zones in Rails applications
Rails time handling is error-prone because Time.now and Time.current can differ. A single-time-zone setup needs matching Active Record and time zone configuration.
Latency and bandwidth illustrated
Latency and bandwidth are often confused but affect network performance in different ways: one is delay, the other is data rate.
Local development with SSL and Puma
Local HTTPS for Puma development needs a trusted certificate and SSL binding so Rails runs on https://localhost:3000 without browser warnings.
Yarn: Use yarn-deduplicate to cleanup your yarn.lock
Duplicate package versions in yarn.lock can bloat bundles and keep unnecessary installs. yarn-deduplicate merges compatible entries in Yarn v1; Yarn v2+ deduplicates natively.
CSS: :is() pseudo selector
:is() groups selector lists and uses the highest specificity of its arguments, simplifying CSS while avoiding repeated compound selectors.
CSS: :where() pseudo selector
:where() matches selector lists with zero specificity, simplifying repeated CSS selectors without affecting override behavior; invalid items in the list are ignored.
Rails: How to check if a certain validation failed
Find out whether a Rails validation failed by checking ActiveModel::Errors types instead of messages, which is useful in tests and for validations with extra options.
Generating and streaming ZIP archives on the fly
Large ZIP downloads can start immediately without writing files to disk, using zip_tricks_stream for custom content or zipline for existing attachments.
Cucumber pitfall: "Around" does not apply to your "Background" steps
Around hooks run only after Background steps, so setup or teardown placed there cannot affect background actions. Use Before and After hooks instead.
Valuable Chrome DevTools Shortcuts
Chrome DevTools shortcuts speed up debugging by toggling the console drawer, adjusting style values faster, and manipulating elements without the mouse.
A short overview of common design patterns implemented within Rails
Rails code patterns help communicate refactor requests, improve code reviews, and introduce reusable approaches such as service objects, presenters, and query objects.
makandra tech survey - results
Survey results highlight common desktop environments, shells, command-line tools, editors, and Vim plugins used by the team.
Fix for mysql2 error "Incorrect MySQL client library version! This gem was compiled for x.x.x but the client library is y.y.y."
mysql2 runtime failures can stem from MariaDB/MySQL client library version mismatches on Linux, especially Ubuntu 22.04; LTS branches remove the client-version check.
Reading the Rails session hash from a Rack middleware
Accessing Rails session data inside Rack middleware is possible through env['rack.session'], which provides an ActionDispatch::Request::Session object.
Fixing flaky E2E tests
E2E tests often fail from race conditions between browser, app and test code; stabilizing them means synchronizing actions, retries and animations.
Fix: esbuild assets are missing after capistrano deploy
esbuild output can disappear after a Capistrano deploy when app/builds is not committed, leaving public/assets incomplete. Sprockets may ignore files in unknown paths.
Writing strings as Carrierwave uploads
CarrierWave needs a filename for string or stream uploads through ActiveRecord; a small StringIO wrapper with original_filename avoids TypeError and works with Zeitwerk.
PostgreSQL: How to show database size
pg_database_size returns a database’s size in bytes; pg_size_pretty formats it into readable units like GB.
The Easiest Way to Parse URLs with JavaScript
Parsing URLs is simpler with an <a> element than with new URL(...), and it also handles incomplete relative paths; IE11 may omit the leading slash.
Icon font vertical alignment in Windows
Icon fonts can line up differently across Windows, Linux and macOS, and vertical-align alone may not fix the baseline mismatch. Adjusting spacing with display:inline-block, padding and margins is often more reliable.
Hiding the clear input button of Edge (with EdgeHTML engine)
Edge and IE11 render a built-in clear button on text inputs that can conflict with custom UI; input::-ms-clear hides it.
Double loading issue with Ruby default gems
Bundler can activate a Ruby default gem before Gemfile.lock is evaluated, causing a version mismatch and Gem::LoadError when a newer installed release is required.