A gotcha of Ruby variable scoping

Ruby local variables are visible after conditional branches, so a missing assignment can yield nil instead of an error and silently produce blank output.

Compare library versions as "Gem::Version" instances, not as strings

String comparison can misorder gem and Ruby versions, letting newer releases slip past checks; Gem::Version gives reliable semantic version comparisons.

How to write complex migrations in Rails

Complex Rails schema changes need SQL, embedded migration models, or adapter helpers when simple add_column and update calls cannot handle existing data safely.

Working on the Linux command line: Use the `tree` command instead of repeated `cd` and `ls`

Directory trees are easier to inspect with tree than repeated cd and ls, especially for nested structures. Depth limits and shell aliases keep output manageable.

Your browser might silently change setTimeout(f, 0) to setTimeout(f, 4)

Nested zero-delay timers are clamped by browsers, so repeated setTimeout(f, 0) calls can run several milliseconds late, especially in background tabs.

How to speed up JSON rendering with Rails

Slow Rails JSON endpoints often waste time in JBuilder, loading full records, and Ruby object allocation. pluck, database aggregation, and cached materialized views can cut response time dramatically.

RubyMine: Adjust Code Templates

RubyMine test file generation can produce excessive boilerplate, and file templates let you tailor the output to project needs.

Protected and Private Methods in Ruby

Ruby method visibility differs from Java: private allows only implicit calls, while protected permits access between instances of the same class or subclasses.

Advisory: Excel converts CSV entries to formulas

Spreadsheet apps can interpret CSV cells beginning with =, +, -, or @ as formulas, turning exported user input into a security risk.

How to: Ensure proper iconfont rendering with Webpack

Custom icon fonts can render as garbled characters after switching from Sprockets to Webpack because CSS charset detection changes. Adding a UTF-8 BOM or an explicit charset can prevent intermittent display failures.

How to query GraphQL APIs with Ruby

GraphQL APIs return nested data through one endpoint, and Ruby can query or mutate them with plain HTTP requests without adding graphql-client.

Rails npm packages will use an uncommon versioning scheme

Rails npm packages need a version mapping from 4-part gem releases to npm’s 3-part semver, so package ranges keep working across patch and prerelease builds.

JavaScript: Humanizing durations

Format durations into the nearest human-readable unit with locale-aware pluralization using Intl.NumberFormat, defaulting to German.

Use the Git stash without shooting yourself in the foot

git stash apply leaves entries in place, so later stashing can restore the wrong changes; git stash pop applies and removes the top stash entry.

Too many parallel test processes may amplify flaky tests

Flaky test suites can fail more often with too many parallel workers; limiting PARALLEL_TEST_PROCESSORS can reduce race-condition failures with only a small runtime cost.

Ruby: Retrieving and processing files via Selenium and JavaScript

Selenium can fetch binary files through JavaScript and return them to Ruby as an array, useful when direct downloads are awkward or blocked.

Cheat Sheet for the modern DOM API

Quick reference for native DOM methods and properties that replace many jQuery calls, helping you find equivalents without browsing Element interfaces.

How to debug file system access in a Rails application

Rails apps can make hidden file checks that slow requests, especially on networked storage. strace reveals unnecessary stat calls and other system calls.

How to push to Git without running CI on GitLab CI, GitHub Actions, or Travis CI

Git pushes can trigger unwanted CI jobs on GitLab, GitHub Actions, or Travis CI. Skip runs with commit-message flags or GitLab push options.

Bundler: Enforce consistent platform versions

Bundler can install different gem variants depending on Gemfile.lock platforms, causing inconsistent native package versions. Locking the target platform improves reproducible installs.

Make Nokogiri use system libxml2

Nokogiri can be built against system libxml2 instead of bundled binaries, reducing rebuild work after security updates and aligning installs with patched OS libraries.

How to force horizontal panel layout for Chrome

Chrome DevTools can switch between vertical and horizontal panel layouts based on width, making deep DOM trees hard to inspect. The panel layout setting forces a preferred orientation.

Capistrano: How to find out which version of your application is currently live

Capistrano stores the deployed commit hash in REVISION, making the live release easy to identify on one server or across multiple hosts.

Simple debounce in vanilla JavaScript

Delays repeated function calls until activity stops, reducing work from noisy events like scrolling and improving performance.