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.
Converting ES6 to ES5 on the command line
Transpiling ES6 JavaScript to ES5 on the command line can produce a smaller output with tsc, but missing APIs still need polyfills.
RubyMine: How to restore the Back to last position shortcut on Ubuntu 20.04
RubyMine navigation shortcuts can stop working on Ubuntu 20.04 because GNOME steals Ctrl+Alt+Arrow Left/Right for workspace switching. Switching to the default GNOME keymap restores back/forward navigation.
Ruby: How to convert hex color codes to rgb or rgba
Convert hex color codes to RGB or rgba values in plain Ruby, including 3-, 6- and 8-digit forms with optional opacity.
Rails 4 introduced collection_check_boxes
Rails 4.0 adds collection_check_boxes for rendering checkbox groups from a collection and handling multi-value form params safely.
Online tool to convert tables between different formats
Online table conversion helps move data between JSON, Markdown and CSV, with transpose support for rotated tables. Not suitable for sensitive data.
Capybara: Preventing headless Chrome from freezing your test suite
Headless Chrome can freeze end-to-end test runs and leave Capybara waiting through long timeouts; restarting sessions regularly and failing fast on lost browser communication reduces hangs.
Capybara: Pretending to interact with the document
Browsers block autoplay and popup APIs until a user gesture occurs; a tiny clicked element can unlock them in Capybara tests.
RSpec: How to test the content of a flash message in a request spec
Rails request specs can verify flash messages in the response, letting controller updates surface user feedback such as success or alert notices.
makandra/capybara-lockstep
Flaky end-to-end tests often fail because Capybara outpaces client-side JavaScript and AJAX; synchronizing commands with browser activity makes full-stack integration suites more stable.
Ruby: Generating and parsing JSON, or: understanding JSON::ParserError "unexpected token"
JSON.parse rejects JSON values produced by to_json for non-Hash and non-Array objects; JSON.generate pairs with JSON.parse, while JSON.load restores Ruby objects and should not handle untrusted input.
Geordi 5.4.0 released
Geordi 5.4.0 adds geordi branch, MySQL dump speedups, Pivotal Tracker ID support in global config, and fixes for dump load requirements and test processor documentation.