Clean code: Avoiding short versions in command options

Shared command examples are easier to read and search when options are written out instead of shortened to cryptic flags.

Git: Restore

git restore reverses staged, unstaged, deleted, or conflicted changes with clearer intent than git checkout, and can restore files from other revisions.

Capybara: Working with invisible elements

Capybara hides non-rendered nodes by default, so hidden UI elements need explicit visibility options to be found or asserted in tests.

Defining and calling lambdas or procs (Ruby)

Ruby Proc objects can behave as strict lambdas or flexible blocks, affecting argument handling and return behavior when code is wrapped as callable objects.

ActiveStorage: How to add a new preprocessed named version

Preprocessed ActiveStorage variants let avatars be generated ahead of time for faster display, but existing records need a one-time backfill after adding the named version.

ActiveStorage: How to copy / clone an attachment from one record to another

Reusing an existing uploaded file for another record avoids reuploading avatars and can copy the blob directly, though large attachments may need a memory-safe approach.

Using Low-Level Prompts for High-Accuracy AI Coding

Precise, low-level prompts and tight context improve AI code edits across files; structured keywords, reusable patterns, and early review reduce guesses and errors.

Git commands to discard local changes

Removing local Git modifications is useful when work needs to be undone, parked temporarily, or cleaned from tracked and untracked files without affecting remote history.

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.