An incomplete guide to migrate a Rails application from paperclip to carrierwave
Rails file storage migration with background jobs, reruns, and URL rewrites; large media backfills need careful testing, queue tuning, and fallback handling.
Colcade is a lightweight Masonry alternative
Lightweight grid layouting for mixed-size items with smaller footprint and no dependencies; performance is better than Masonry, but column spanning and built-in transitions are missing.
How to keep using secrets.yml after upgrading to Rails 7.2
Rails 7.2 removes Rails.application.secrets; existing apps can keep secrets.yml by mapping it back with config_for and restoring secret_key_base.
Pivotal Tracker now supports story description templates
Pivotal Tracker story descriptions can now use pasted templates, with custom templates created under More > Templates; the three default templates remain fixed.
Faking Flexbox with legacy techniques
Internet Explorer lacks reliable Flexbox support, so similar layout effects often need older CSS techniques instead of modern flexbox syntax.
The Definitive Guide to Cookie Domains
Cookie domain restrictions limit which hosts receive session cookies and other secrets, reducing leakage across subdomains and making host naming choices security-relevant.
Minimal JavaScript function to detect version of Internet Explorer or Edge
User-agent sniffing can still be necessary when Microsoft browsers need special handling. ieVersion() extracts Internet Explorer 10/11 and Edge version numbers, returning undefined for others.
SSH: X-Forwarding
Remote graphical programs can run on your local desktop through SSH, but X11 forwarding is slower and exposes your X session to a trusted host.
How to fix: Corrupt special characters in ZIPs on Linux
ZIP files from Windows users can corrupt umlauts and other non-Latin1 filenames on Linux because of CP850 encoding. unzip -O CP850 handles these archives correctly.
Chrome bug: Wrong stacking order when transitioning composited elements
Chrome can render composited slider elements in the wrong stacking order during CSS transitions, causing overlapping content to appear above neighboring elements until motion ends.
Haml: Generating a unique selector for an element
Haml can derive stable CSS classes and IDs from Ruby objects, making elements easy to target from JavaScript or Unpoly updates.
Haml: Prefixing a group of attributes
Prefix several HTML attributes at once in Haml by nesting them in a hash with {} syntax; () attribute syntax does not support grouped prefixes.
3 ways to run Spring (the Rails app preloader) and how to disable it
Rails commands can start Spring unexpectedly, and DISABLE_SPRING disables it only for non-explicit invocations. Different launch paths affect console and rake behavior.
Debugging Webpacker config
Webpacker configuration can be hard to inspect when builds misbehave; dumping the environment, using browser or Node debugging, and emitting warnings help reveal the active webpack settings.
Introduction to Google Tag Manager (for web developers who know Google Analytics)
Configuring analytics without code changes keeps tracking flexible, but GTM adds complexity and security risk. Tags, triggers, and variables centralize event and pageview tracking.
Rails: Flagging all cookies as secure-only to pass a security audit
Secure cookies are often required by audits even when a Rails app already uses HTTPS and HSTS. A middleware can add the Secure flag to server-set cookies automatically.
JavaScript “Stale Practices” | benmccormick.org
ES5-era JavaScript best practices have stale alternatives in modern code, and older patterns can become outdated as the language evolves quickly.
Make a local copy of an S3 bucket
Backup or mirror an Amazon S3 bucket to a local directory with s3cmd, using a dry run before the full sync.
Fix for Ruby 1.8.7 installation error
Ruby 1.8.7 installation with ruby-build can fail on some machines with a math.c compiler error. Installing ruby-1.8.7-p374 avoids the issue.
Heads up: Rails offers two similar means for text truncation
Rails has both truncate helper and String#truncate; the helper is preferred for block support and safer HTML handling, especially with escape: false.
Using the Ruby block shortcut with arguments
Passing arguments to Ruby’s block shorthand makes map(&:method) usable for nested lookup and JSON extraction without full block syntax.
Ruby: All Errno::ERROR constants inherit from SystemCallError
Network calls can fail with many Errno:: exceptions; rescuing SystemCallError groups them under one base class and simplifies error handling.
Cucumber steps to travel through time with Timecop
Cucumber step definitions for Timecop provide date and time travel in tests, including relative shifts into the past or future; Selenium browser time needs timemachine.js.
Rails' Insecure Defaults - Code Climate Blog
Rails has solid built-in protection, but some default behaviors remain risky in Rails 3 and parts of Rails 4. Security gaps can still leave apps exposed.