Webpack: Automatically generating an icon font from .svg files
Vector icons are easy to use but tedious to build; webpack plugins can automate SVG-to-icon-font generation and keep icons aligned, scalable, and JavaScript-free.
IE11: Trigger native mouse events with Javascript
IE11 needs real DOM mouse events for code that listens to native handlers as well as jQuery .on; synthetic clicks from trigger are not enough.
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.
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: "git log" with renamed files
File renames can hide earlier revisions from git log; git log --follow preserves the full history for a single renamed file.
How to create memory leaks in jQuery
Detached jQuery elements with event handlers or data can stay in memory because cache entries survive native DOM removal and old IE circular-reference limits.
RestClient / Net::HTTP: How to communicate with self-signed or misconfigured HTTPS endpoints
HTTPS requests fail against self-signed certificates or broken certificate chains unless the correct CA, intermediate cert, or certificate store is configured.
Ruby: Fixing strings with invalid encoding and converting to UTF-8
Invalidly encoded external strings can break UTF-8 handling; trying several conversions and replacing unknown bytes helps salvage readable text.
Disabling client caching with Cache-Control: no-store
Browser caching can show stale state in apps like time trackers or SPAs. Setting Cache-Control: no-store forces a fresh response instead of reusing cached pages.
Pre-releasing an npm package
Publish npm pre-release versions on a separate tag so stable users do not receive alpha or beta builds by default.
Pre-releasing a Ruby gem
Release candidate and beta gem versions are treated as pre-releases and are ignored unless explicitly requested; RubyGems converts dash-separated SemVer pre-release tags to dot-separated versions.
How to use ActiveSupport Concerns with dynamic relations
Dynamic ActiveSupport::Concern relations can misread self.class in polymorphic associations, producing the wrong condition. Using self.included with the host class keeps has_many scopes bound correctly.
RubyMine: How to exclude single files
Exclude individual files from RubyMine search and navigation by adding filename masks in Project Structure settings.
Carrierwave: Using a nested directory structure for file system performance
Large CarrierWave stores can overload a single directory with too many entries, slowing navigation and filesystem operations. Splitting record IDs into nested folders keeps directories manageable.
Debugging your Webpack build time with Speed Measure Plugin
Slow Webpack builds can be profiled to pinpoint time spent in loaders and modules. Speed Measure Plugin adds per-compile timing output for identifying optimization opportunities.
Running code before or after a Rake task
Run code before or after an existing Rake task by adding dependencies or enhancing the task with a block.
Webpacker: Loading code on demand
Large libraries can bloat every page when only one screen needs them. import() loads code on demand and Webpack emits a separate chunk automatically.
When does Webpacker compile?
Webpacker compiles assets on demand in Rails, which can freeze helpers and slow page reloads when no dev server is running.
Linux: Using grep with a regular expression
grep supports basic, extended POSIX, and Perl-compatible regular expressions; -P is often closest to Ruby-style regex syntax, while -G and -E differ in metacharacter handling.
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+.
Bundler: Packaging gems into the git repository (offline installation)
Offline gem installation with Bundler requires checking dependencies into the repository and configuring local paths for bundle install without rubygems.org access.
How to generate and test a htpasswd password hash
Create and verify bcrypt password hashes for Apache authentication, with safer handling than command-line password entry.
Emulating document.currentScript in old browsers
document.currentScript is missing in older browsers, making it hard to read a running <script> element’s attributes or nearby DOM. A simple document.scripts fallback works only for non-async scripts.
Capistrano: Deployment issue undefined method `[]' for nil:NilClass
Newer Passenger versions change passenger -v output, breaking capistrano-passenger version parsing and causing undefined method '[]' for nil:NilClass during deployment.