Debounced search input (React)

Search boxes are a classic place to accidentally fire a request on every keystroke. I debounce the value that triggers the query (not the input rendering) so typing stays responsive, and I cancel/ignore stale requests so results don’t arrive out of or

WKWebView for web content display

WKWebView displays web content with modern WebKit rendering engine. It replaces deprecated UIWebView with better performance and security. I configure WKWebViewConfiguration to customize behavior like JavaScript, cookies, and media playback. Navigatio

Terraform AWS RDS and ElastiCache provisioning

Terraform provisions managed database services declaratively. AWS RDS supports PostgreSQL, MySQL, and other engines with aws_db_instance. The engine_version pins database versions. instance_class sets compute size. allocated_storage and max_allocated_

Token bucket rate limiter for outbound calls

Outbound rate limiting is one of those “quiet reliability” features: customers rarely notice it until it’s missing. I prefer a simple token bucket using golang.org/x/time/rate because it’s well-tested and easy to reason about. Each call waits for a to

ActiveJob for queue adapter abstraction

ActiveJob provides a unified interface across different queue backends (Sidekiq, Resque, Delayed Job), making it easier to switch adapters or test jobs. I define jobs by inheriting from ApplicationJob and implementing perform. ActiveJob handles serial

Database migration with Flyway

Flyway manages database schema evolution through versioned SQL scripts. Migration files follow naming convention—V1__initial_schema.sql, V2__add_users_table.sql. Flyway tracks applied migrations in a schema history table. Migrations run automatically

Optimistic Locking for Collaborative Edits

If multiple admins edit the same record, use lock_version. Rails will raise on conflicting updates, and you can show a friendly “this changed underneath you” message. It prevents subtle lost updates.

Turbo Streams: update document title with a custom action

Sometimes the DOM updates but the browser tab title stays stale (e.g., unread count, active chat room). A neat Hotwire trick is a custom Turbo Stream action that sets document.title. The server emits a <turbo-stream action='set_title'> with a te

Dark mode support and adaptive colors

Dark mode provides low-light interface that reduces eye strain and saves battery on OLED displays. iOS automatically switches based on system settings or user preference. I use semantic colors like .label, .secondaryLabel, and .systemBackground that a

Database view-backed models for complex queries

Complex reporting queries with multiple joins and aggregations can become unmaintainable in ActiveRecord. PostgreSQL views encapsulate query complexity in the database layer and appear as regular tables to Rails. I create views for common reporting ne

Window functions for advanced analytics

Window functions perform calculations across row sets without grouping. ROWNUMBER assigns unique sequential numbers. RANK/DENSERANK handle ties differently. I use PARTITION BY to reset calculations per group. ORDER BY determines calculation order with

Idempotent event consumer with processed-events table

At-least-once delivery is the default for most queues and streams, so consumers must be idempotent. My go-to pattern is a processed_events table keyed by event_id with a unique constraint. When a message arrives, the consumer tries to insert event_id;