Rails N+1 query detection with Bullet

N+1 queries are the most common Rails performance problem—loading associations in loops causes exponential database queries. The Bullet gem detects N+1s in development and suggests fixes. It monitors queries and alerts when you should use includes, pr

Laravel rate limiting for API protection

Rate limiting prevents API abuse by restricting request frequency per user or IP. Laravel's RateLimiter facade defines limits in RouteServiceProvider. I apply limiters via middleware—throttle:api for the default API limiter. Custom limiters use closur

Laravel broadcasting with Pusher for real-time events

Broadcasting enables real-time features by pushing server events to connected clients via WebSockets. I implement ShouldBroadcast on events to automatically broadcast them when fired. The broadcastOn() method defines channels—public, private, or prese

Jetpack Compose declarative UI fundamentals

Jetpack Compose revolutionizes Android UI development with declarative, Kotlin-first approach. Composable functions annotated with @Composable describe UI based on state. The runtime automatically updates UI when state changes using remember and mutab

Turbo Streams: inline “saved” indicator that updates on autosave

Users trust autosave when they can see it. I render a small #save_state region (“Saved just now”, “Saving…”, “Offline”) and update it via Turbo Streams. The autosave endpoint returns a stream that replaces the indicator, and optionally updates a hidde

Avoid bufio.Scanner token limits by switching to Reader

bufio.Scanner is great until it isn’t: by default it refuses tokens larger than 64K, which makes it a bad fit for long log lines or large JSON records. The failure mode is subtle—scan stops and Err() returns a token-too-long error. For production log

Parking_lot for faster synchronization primitives

parking_lot provides drop-in replacements for Mutex, RwLock, and Condvar that are faster and smaller than std::sync. They use more efficient parking/unparking and don't poison on panic. I use parking_lot::Mutex in hot paths where lock contention matte

Django Q objects for complex queries

Q objects enable complex query logic with OR, AND, and NOT operations. I combine them with | for OR and & for AND. The ~Q() syntax negates a condition. This is cleaner than raw SQL for dynamic filters. I build Q objects conditionally based on user

AWS VPC and networking with Terraform

Build production-ready AWS VPC infrastructure using Terraform. Create public and private subnets across availability zones, configure NAT gateways, internet gateways, and route tables. Implement network ACLs and VPC flow logs for security and observab

Preview Active Storage uploads after attach using Turbo Streams

For image uploads, I like immediate previews. With Active Storage, you can render the preview server-side once the blob is attached, and use Turbo Streams to update the preview area. The form submits to an endpoint that attaches the blob and returns a

ESLint config that avoids bikeshedding

I want linting to catch bugs, not fuel style debates. I use ESLint for correctness rules (unused vars, no-floating-promises, React hooks rules) and let Prettier handle formatting. I keep overrides minimal and justified. I also treat lint as part of CI

Form objects for complex form handling

Form objects encapsulate form logic separate from models. I use form objects for multi-model forms, complex validations, or forms not directly mapping to models. Form objects include ActiveModel modules for validations and callbacks. They handle param