RSpec: Tagging examples and example groups
Tagging RSpec examples and groups lets you filter slow or special cases, assign values, and trigger hooks or module includes by metadata.
PSA: "index: true" in Rails migrations does not work as you'd expect
index: true is silently ignored in some Rails migration methods like add_column, so missing database indexes can go unnoticed and hurt query performance.
Writing a README for a project
A project README gives new developers a quick overview, key architecture, and setup notes. Keep it concise, focused on essentials, and separate detailed class documentation.
Google Analytics: Changing the tracked URL path
Google Analytics can record a custom path instead of the current URL, useful for hidden tokens, grouped pages, or interactions without a request.
The Ruby Object Model
Ruby’s object model can be confusing for developers from static languages. Objects, singleton classes, and modules shape method lookup, class methods, and inheritance.
Installing Python packages using pip on Ubuntu 24.04
Ubuntu 24.04 blocks system-wide pip installs with an externally managed environment error; use apt, venv, or pipx instead.
Shell script to magically configure display setup
Bash script for Xorg on Ubuntu 24.04 that auto-arranges connected monitors, sets the external screen as primary, and can switch the internal panel to a fixed resolution.
Debug your Postgres SQL query plan
Slow SQL queries can hide expensive scans and missed indexes; inspecting the PostgreSQL execution plan helps pinpoint bottlenecks and optimize query performance with explain and pev2.
Rails and Postgres: How to test if your index is used as expected
Rails and Postgres index usage can be verified by running the generated SQL with EXPLAIN ANALYZE and temporarily disabling sequential scans.
HTML: Making browsers wrap long words
Long words can overflow layouts when browsers wrap only at word boundaries. CSS hyphenation, soft hyphens, <wbr>, and overflow-wrap offer different control levels.
How to reduce a video's file size with ffmpeg
Reduce video file size by re-encoding with ffmpeg, keeping audio intact and enabling fast start playback. H.264 or H.265 encoding balances quality and compression.
How to disable telemetry for various open source tools and libraries
Telemetry and analytics in open source CLIs and frameworks often require explicit opt-out settings or environment variables to stop data collection and crash reporting.
How to use your favorite font in Slack
Slack’s font picker is limited, but the chat font can be switched to any locally installed typeface with /slackfont; Snap installs may only see system-wide fonts.
BEM naming conventions
BEM class names vary across projects, and mixing conventions makes CSS harder to read and maintain. A consistent block, element and modifier naming style prevents confusion.
How to send HTTP requests using cURL
Send HTTP requests from the command line with curl, including custom methods, form data, and basic authentication.
ActiveRecord: Passing an empty array into NOT IN will return no records
Empty exclusion lists in NOT IN conditions can silently return no rows; where.not in Rails 4+ handles empty arrays safely.
Rails: Accessing strong parameters
Rails parameters need careful filtering before mass assignment or URL generation; expect, require, permit, slice, and except help avoid security issues and noisy extras.
How to write a good image alt text
Choosing alt text for <img> depends on whether an image is decorative, contains text, or carries meaning in links and buttons.
CSS & a11y: When hiding with opacity, also set visibility:hidden (transitions supported)
Opacity alone hides only visually, leaving elements focusable and exposed to screen readers. Pairing it with visibility:hidden keeps fade transitions smooth and accessibility intact.
Enumerators in Ruby
Ruby each methods can return an enumerator when no block is given, enabling lazy iteration, chaining, and pagination-friendly data fetching.
ActiveSupport includes Timecop-like helpers
Rails test helpers let you freeze or shift time without Timecop; travel_to, travel, and freeze_time simplify time-dependent specs when clock progression does not matter.
Heads up: pg_restore --clean keeps existing tables
pg_restore --clean removes data from dumped tables but leaves extra tables in place, which can break later migrations when restoring a staging dump locally.
Rails 8 introduces `params.expect`
Rails 8 adds params.expect to validate incoming parameters more explicitly, reducing malformed input errors and simplifying strong parameter handling.
Specify Gemfile for bundle
BUNDLE_GEMFILE selects a nondefault Gemfile for Bundler, making it possible to work with multiple Gemfiles in one project and test against different Rails versions.