Timeouts for long-running SQL queries

Database query limits prevent runaway SQL from consuming all resources; PostgreSQL statement_timeout and MySQL max_execution_time can cancel slow statements automatically.

Ruby: Replacing Unicode characters with a 7-bit transliteration

Unicode characters can break 7-bit string transport; transliteration to Low-ASCII keeps text usable where escaping is not possible.

Be careful when copy & pasting code from the web to your terminal

Copied terminal commands can hide invisible Unicode characters or lookalike symbols, causing unexpected behavior. Checking exact code points helps avoid paste-related mistakes.

RSpec: Increase readability with super_diff

Hard-to-read RSpec diffs for nested hashes and collections can be improved with super_diff, which formats expectation mismatches more clearly.

Don't compare datetimes with date ranges in MySQL and PostgreSQL

Date ranges can silently miss rows when compared to created_at datetimes in MySQL or PostgreSQL, because the end date is cast to midnight and late-day records are excluded.

Chrome Lighthouse

Built-in Chrome auditing checks performance, accessibility, and other quality signals for web apps, including private or local pages. Development settings can skew results; Webpagetest is an alternative.

Using tig

tig is a terminal interface for browsing Git history, diffs, status, and stashes with keyboard-driven navigation.

Learn how to use ruby/debug

Interactive Ruby debugging with ruby/debug supports breakpoints, stack inspection, scripted commands, and remote sessions when stdin is unavailable.

Open Terminator from nautilus context menu

Adds a Nautilus context-menu entry that opens the current folder in Terminator instead of GNOME Terminal.

Using the ActiveSupport::BroadcastLogger

ActiveSupport::BroadcastLogger sends one log message to multiple outputs, useful for writing Rails and Sidekiq logs to both STDOUT and files.

High-level data types with "composed_of"

Rails composed_of bundles several columns into one value object, but immutability, validation, caching, and form handling remain fragile.

How to allow testing beforeunload confirmation dialogs with modern ChromeDrivers

ChromeDriver 127 closes beforeunload prompts immediately in HTTP sessions; BiDi mode with unhandled_prompt_behavior: { default: 'ignore' } keeps them open for automated tests.

Optimizing images for the web

Fast webpages need smaller image files without visible quality loss; resizing, stripping metadata, and using formats like WebP can greatly reduce size.

Don't require files in random order

File loading order from Dir.glob can vary by file system and break code that depends on load sequence. Sorting the matched paths or using sort: false in Ruby 3 makes it predictable.

Git: How to configure git to push only your current branch

Prevent accidental multi-branch pushes by setting push.default to current; it pushes only the checked-out branch, but new remote branches may need tracking setup.

Rails: How to stub the env in Rails 7+

Rails 7.1 adds Rails.env.local?; stubbing Rails.env with a plain string can fail, while ActiveSupport::EnvironmentInquirer keeps environment checks working.

esbuild: Compressing JavaScript harder with Terser

Terser can shrink JavaScript bundles further than esbuild's minifier, at the cost of noticeably longer build times.

A simple example with a GIN index in Rails for optimizing a ILIKE query

ILIKE searches in PostgreSQL can be slow without trigram indexing; a GIN index with pg_trgm can replace sequential scans with bitmap index scans.

Logging multiple lines in Rails without making filtering your logs difficult

Multi-line Rails logs are hard to filter because only the first line gets tagged. Logging each line separately keeps request IDs and timestamps on every line.

How to: Benchmark an Active Record query with a Ruby script

Benchmarking Active Record queries needs repeated runs and cache clearing to measure realistic PostgreSQL performance; a Ruby script can report percentile timings.

Your Rails sandbox console

rails console --sandbox lets you test database changes in a console session and automatically rolls them back on exit, while file and email actions remain permanent.

Understanding race conditions with duplicate unique keys in Rails

validates_uniqueness_of can still allow duplicate records under concurrent requests; a unique database constraint prevents the race and turns collisions into ActiveRecord::RecordNotUnique.

Devise: Don't forget to lock users with soft delete

Soft-deleted users can stay authenticated in Devise unless account activity checks are tied to the trash state. Customizing active_for_authentication? blocks sign-in and protects password reset flows.

Terser is good at minifying JavaScript

Terser compresses JavaScript aggressively, merging branches, inlining small functions, and folding constants to cut output size further than expected.