HTTP server timeouts that prevent slowloris and stuck connections

The default http.Server will happily keep connections open longer than you intended, which is how you end up with “mysterious” goroutine growth during partial outages. I set ReadHeaderTimeout to protect against slowloris-style attacks, keep IdleTimeou

Lazy loading routes with React.lazy and Suspense

Code splitting routes reduces initial bundle size and improves load times. React's lazy function dynamically imports components when routes are accessed. Wrapped in Suspense, lazy components show fallback UI while loading. I group related routes into

Fan-out with errgroup and shared cancellation

When you need to call multiple downstream systems, errgroup is a great way to express “do these in parallel, cancel on first failure.” The key is using errgroup.WithContext, not a plain WaitGroup, so the group can propagate cancellation. Each goroutin

Rails concerns for shared controller behavior

Concerns extract shared logic from controllers into reusable modules, keeping controllers DRY. I create concerns for cross-cutting features like authentication, pagination, or error handling. The extend ActiveSupport::Concern pattern provides included

Sentry initialization with release + environment

Noisy error reporting without context turns into a pile of untriaged alerts. I initialize Sentry early, set the release from the git SHA, and tag the environment so I can separate staging from production. I also set a sample rate and capture only what

Service objects for complex business logic

As business logic grows, controllers become bloated with transaction management, error handling, and cross-model orchestration. Service objects extract this complexity into dedicated classes with a single public method (usually call), keeping controll

Scheduled tasks with @Scheduled

Spring's @Scheduled annotation enables method execution on fixed intervals or cron expressions. @EnableScheduling activates scheduling infrastructure. Fixed delay waits after completion, fixed rate executes at intervals regardless of duration. Cron ex

Combine framework for reactive programming

Combine provides a declarative Swift API for processing values over time, perfect for handling async events like network requests, user input, and timers. Publishers emit sequences of values, and subscribers receive them. Operators transform, filter,

GraphQL APIs with graphql-ruby gem

GraphQL enables clients to request exactly the data they need. The graphql-ruby gem implements GraphQL servers in Rails. Types define data structures—ObjectTypes for models, InputTypes for mutations. Queries fetch data; mutations modify data. Resolver

VecDeque<T> for double-ended queue operations

VecDeque&lt;T&gt; is a growable ring buffer supporting efficient push/pop from both ends. I use it for queues, breadth-first search, and sliding windows. Methods: .push_front(), .push_back(), .pop_front(), .pop_back() are all O(1). It's implemented as

Database transactions and isolation levels

Spring's @Transactional manages database transactions declaratively. Transaction propagation controls behavior when methods call other transactional methods—REQUIRED, REQUIRESNEW, NESTED. Isolation levels prevent concurrent access issues—READUNCOMMITT

Stimulus: copy-to-clipboard with fallback + selection

Copy buttons are deceptively tricky across browsers. This Stimulus controller uses the Clipboard API when available, falls back to execCommand, and provides a hook for “Copied!” UI.