Execution of shell code in Ruby scripts
Deprecated Ruby ways to run shell commands can be unsafe or behave differently; capture3 is the preferred option for new code.
How to install npm packages globally without sudo on Linux
Install Node global packages in a user-owned directory so npm install -g works without sudo and added executables are available on your PATH.
Rails Asset Pipeline: Building an Icon Font from SVG Files
Asset pipeline setups can still build an icon font from SVG files, but the workflow needs manual generation and stylesheet integration.
Migrating from CoffeeScript to ES6
Moving from CoffeeScript to ES6 is straightforward with decaffeinate, which converts .coffee files to modern JavaScript and may need manual cleanup afterward.
Fun with Ruby: Returning in blocks "overwrites" outside return values
return inside a block can replace a method’s own result and skip later code, which can break Rails helpers like capture and lose html_safe? information.
Better compression for /boot partition
A too-small /boot partition can block updates; switching initramfs compression to xz may shrink boot images without resizing the partition.
Use "overflow: hidden" to avoid floating elements from wrapping a container's text
A floated sidebar can make surrounding text wrap underneath it; overflow: hidden creates a new block formatting context that keeps the content from flowing around the float.
Function Composition in Ruby
Ruby 2.6 adds Proc and Method composition, making functional-style chaining possible in Ruby code.
Webpacker: Side effects of using window.* within the ProvidePlugin
Using window.jQuery in ProvidePlugin can leave jQuery undefined in the browser while $ still works; assigning through global avoids the conflict.
PostgreSQL vs MySQL: How to UPDATE using a JOIN
Updating rows from a related table is needed when backfilling cached data. PostgreSQL and MySQL use different UPDATE join syntax for copying associated values.
How to test Autoprefixer and CSSnext in PostCSS
PostCSS plugin output can be verified by compiling assets and checking Autoprefixer and CSS feature transforms from postcss-preset-env.
Speed up your websites: Put JavaScripts at bottom
Placing JavaScript at the end of the page lets content render sooner in non-client-side apps, reducing perceived load time while keeping scripts centralized.
HTML emails with inline stylesheets and webpacker
HTML emails often break when mail clients ignore external stylesheets. premailer-rails inlines CSS for Rails mailers, and inline image attachments improve compatibility.
Migration from the Asset Pipeline to Webpacker
Moving a Rails app from the Asset Pipeline to Webpacker requires inventorying bundled libraries, repackaging legacy assets, and adjusting deployment for pack-based assets.
MySQL: How to create columns like "bigint" or "longtext" in Rails migrations, and what :limit means for column migrations
Rails migration column sizes depend on type: :limit controls bytes or characters, and certain values map to MySQL tinyint, smallint, mediumint, bigint, text, mediumtext, or longtext.
Github Cheat Sheet
Hidden and lesser-known Git and GitHub features can speed up everyday workflows and reduce friction for version control and collaboration.
During deployment: "You are trying to install in deployment mode after changing your Gemfile"
Deployment can fail with a misleading Gemfile error when the server uses a newer Bundler than the version recorded in Gemfile.lock. Matching Bundler major versions on both sides prevents the install mismatch.
How to doubleclick in Selenium
Capybara tasks can be double-clicked by using Selenium-backed double_click on the matched element; plain Capybara alone does not handle double-clicks.
Why you can't use timezone codes like "PST" or "BST" for Time objects
Timezone abbreviations are ambiguous and often unsupported in Rails time handling; ActiveSupport zone names and offsets avoid wrong parsing, DST mistakes, and misleading displays.
Git: Revert one or more commits
Reverting creates a new commit that undoes earlier changes, useful for backing out a single change or several related commits without rewriting history.
CSS: Flex and "min-width"
Flex items can overflow small screens because min-width:auto prevents shrinking below content size; min-width: 0 lets them fit available space.
Using local fonts with Webpack / Webpacker
Using self-hosted or purchased fonts with Webpack or Webpacker requires either bundling them from assets or packaging them locally for clean imports.
rails_state_machine 1.1.2 released
valid? no longer changes a record's state in rails_state_machine 1.1.2, preventing validation checks from causing unintended transitions.
How to fix parallel_tests with Redis on powerful machines
Parallel test runs can exceed Redis’s default 16 databases on multi-core machines, causing ERR DB index is out of range; increasing the database limit resolves it.