CORS allowlist middleware (no wildcard surprises)

CORS is one of those features that becomes security-sensitive by accident. Instead of Access-Control-Allow-Origin: *, I keep a strict allowlist and echo back the exact origin only when it’s approved. I also handle OPTIONS preflight requests explicitly

ArgoCD GitOps continuous deployment for Kubernetes

Implement GitOps with ArgoCD for declarative, git-driven Kubernetes deployments. Configure Application and ApplicationSet resources, automated sync policies, health checks, and multi-environment promotion. Keep your cluster state in sync with your Git

Database design patterns and anti-patterns

Database design patterns solve recurring problems. I use the Repository pattern to abstract data access. Active Record maps objects to tables. Unit of Work tracks changes for batch commits. Identity Map caches loaded entities. The Specification patter

Enumerables and collection manipulation

Ruby's Enumerable module provides rich collection methods. map transforms elements; select/reject filter. reduce aggregates values. find returns first match; find_all returns all matches. group_by partitions by criteria. partition splits into two arra

Web Components and Shadow DOM encapsulation

Web Components create reusable custom elements with encapsulated functionality. I use Custom Elements API to define new HTML tags with customElements.define(). Shadow DOM provides style and markup encapsulation preventing CSS leakage. HTML Templates w

SEO optimization with React Helmet

SPAs struggle with SEO because content loads via JavaScript after the initial HTML. React Helmet manages document head tags like title, meta descriptions, and Open Graph tags per route. Each page component declares its own metadata, and Helmet ensures

Django model inheritance with abstract base classes

Abstract base classes let me define common fields and methods without creating database tables. I set abstract = True in Meta. Concrete models inheriting from the abstract class get all its fields and methods. This is perfect for timestamps, soft dele

Disable Turbo Drive on external links

Turbo Drive is great for internal navigation, but I disable it for external links or pages that should do a full reload (third-party auth, docs). data-turbo='false' is the simplest switch: it tells Turbo not to intercept the click, so the browser hand

CSS architecture patterns: BEM and utility-first approaches

BEM (Block Element Modifier) naming uses .block__element--modifier pattern for scalable CSS. I define blocks as independent components like .card. Elements within blocks use .card__title and .card__body. Modifiers indicate variations with .card--featu

Django haystack for advanced search

Haystack provides unified search across backends (Elasticsearch, Solr, Whoosh). I define search indexes mapping models to searchable fields. It handles full-text search, faceting, and highlighting. The SearchQuerySet API is similar to Django's ORM. I

Turbo Streams: server-driven redirect (Turbo Native friendly)

Sometimes you want to “redirect” from a turbo stream response (especially for Turbo Native flows). Returning a stream that updates a frame to include a turbo-visit shim keeps behavior consistent across clients.

DataStore for modern preferences

DataStore replaces SharedPreferences with coroutine and Flow support. Preferences DataStore stores key-value pairs with type safety using preferencesDataStore delegate. Proto DataStore stores typed objects using Protocol Buffers. I use dataStore.data