RSpec: Applying stubs only within a block

RSpec mocks normally persist for a spec; RSpec::Mocks.with_temporary_scope limits temporary stubs to a block and releases them afterward.

Always convert and strip user-provided images to sRGB

User-uploaded images can lose correct colors if metadata is stripped before color conversion. Converting to sRGB and reattaching the profile keeps browser rendering consistent.

Disable text-transforms in Selenium tests

text-transform: uppercase can make Selenium assertions flaky and break umlaut handling; disabling transforms in tests improves reliable label text matching.

Ruby: Referencing global variables with the built-in English library

Ruby’s special global variables are harder to read and can fail without require 'English', especially in Rails where the library is not loaded by default.

Ruby: How to make your ruby library configurable

Configuring a Ruby library via a block makes endpoints and similar settings easy to override without hardcoding values.

JavaScript: Sharing content with the native share dialog

Native share dialogs on mobile and desktop let users hand off links, text, and titles to installed apps; navigator.share works only on HTTPS pages.

Let the browser choose the protocol

Protocol-dependent links break mixed-content embeds and tests; protocol-relative URLs let the browser pick http or https from the page context.

Advanced plotting in Ruby with Gnuplot

Complex plots in Ruby often need direct access to Gnuplot syntax for histograms, boxplots, and multi-column data. Ruby wrappers differ in how much file handling and array support they hide.

A nicer way to run RSpec and/or Cucumber

Convenience scripts streamline RSpec and Cucumber runs with bundle exec, parallel execution, spinner support, and a full test check against regressions.

Using Capybara finder methods with arbitrary matching conditions

Capybara matchers and finders can take a Ruby block for extra DOM conditions when built-in options are not enough. Script calls inside filter blocks need a temporary wait time to avoid Selenium timeouts.

Rails: Preloading associations in loaded records

Preloading nested associations on already loaded ActiveRecord objects avoids extra queries when rendering deeply related data and fits legacy Rails models via preload_associations.

Preventing users from uploading malicious content

Uploaded HTML or SVG can execute JavaScript and steal session cookies; safer uploads rely on extension allowlists, strict CSP, attachment disposition, or octet-stream delivery.

Cucumber step to match table rows with Capybara

Cucumber step for checking table rows in Capybara, with optional exact matching, row order control, wildcards, and support for colspan or rowspan tables.

Checklist for Implementing Design

Design changes need more than visual parity: implementations should be tested, responsive, touch-friendly, accessible, localized, and consistent with existing patterns.

How to hide your selenium browser window with "headless"

Selenium browser windows can steal focus during Cucumber acceptance tests; headless with xvfb keeps them hidden while running Selenium WebDriver through Capybara.

Opt out of selenium manager's telemetry

selenium-webdriver can send hourly usage stats during browser feature specs; setting SE_AVOID_STATS=true disables the telemetry call.

Running "bundle update" will update all gems without constraints

bundle update without arguments refreshes every gem and can break an app; updating gems regularly and conservatively reduces risky dependency changes.

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.

Heads up: Quering array columns only matches equally sorted arrays

PostgreSQL array queries in Rails match element order, so [16, 17] and [17, 16] are different. Order-independent matching needs normalization or bidirectional containment.

How to write modular code

Reduce spaghetti code by splitting behavior into focused functions, service classes, form models, and value objects, while avoiding long parameter lists and excessive DRY.

An introduction to Hybrid search

Hybrid search combines vector retrieval and BM25 keyword search to catch paraphrases and exact terms, improving recall when either method alone misses relevant documents.

Optimizing images for LLM inference

Reducing image size and trimming whitespace lowers vision-token cost while keeping text readable; OCR-based strip slicing can keep dense pages within context limits.

How to define a table prefix for all Rails models in a namespace

Rails namespaces can produce doubled table prefixes when table_name_prefix is set on individual models. Defining it on the namespace module keeps nested model table names correct.

A simpler default controller implementation

Rails controllers can stay short, testable and authorization-friendly by using a minimal shared blueprint for CRUD, strong params, scopes and optional HTTP caching.