CodeSnips
Collections
Coders
Sign in
Join us today
Share your craft projects Make new craft buddies Ask craft questions Blog your craft journey

Leah Thompson

78 code snips and 0 followers in about 2 hours
Follow
Profile 78 Code snips 0 Collections Likes Activity
  • Posted Panic recovery middleware that fails closed and logs context

  • Posted Retry Postgres serialization failures with bounded attempts

  • Posted errors.Join for cleanup (surface multiple close failures)

  • Posted Capture status code and bytes written via ResponseWriter wrapper

  • Posted WriteJSON helper with consistent headers and status

  • Posted Strict JSON decode helper (size limit + unknown fields)

  • Posted Track in-flight requests with atomic counters

  • Posted Content sniffing for uploads (don't trust the header)

  • Posted Idempotent event consumer with processed-events table

  • Posted expvar counters for quick-and-dirty production introspection

  • Posted Set a soft memory limit with debug.SetMemoryLimit

  • Posted sync.Pool for bytes.Buffer to reduce allocations in hot paths

  • Posted Redis Pub/Sub subscriber with reconnect-friendly loop

  • Posted sqlc transaction wrapper that keeps call sites clean

  • Posted Store unstructured JSON safely with json.RawMessage

  • Posted Enforce JSON Content-Type and method early in handlers

  • Posted CIDR allowlist middleware using netip (trust boundary explicit)

  • Posted Inbound rate limiting middleware with token bucket

  • Posted Context-aware cache refresh with atomic.Pointer (Go 1.19+)

  • Posted Sampling logs to reduce noise during high-QPS incidents

  • Posted Lazy init of expensive clients with sync.Once

  • Posted HTTPtrace to debug DNS/connect/TLS timing in production-like runs

  • Posted Run database migrations on startup (with a guard)

  • Posted db/sql prepared statements with context and explicit Close

  • Posted Avoid bufio.Scanner token limits by switching to Reader

  • Posted Streaming CSV import with batched inserts

  • Posted Strict JSON time parsing with custom UnmarshalJSON

  • Posted Graceful gRPC shutdown with fallback to Stop

  • Posted mTLS client configuration with custom root CA pool

  • Posted Email delivery via HTTP provider with context, timeout, and idempotency

  • Posted Safe YAML decoding (KnownFields) for config files

  • Posted Template rendering with html/template and strict escaping

  • Posted Robfig cron jobs with context cancellation and jitter

  • Posted JSON schema-ish validation with custom error details

  • Posted Robust environment parsing for bool/int with explicit defaults

  • Posted Retry on 429 with Retry-After parsing

  • Posted HTTP client middleware via RoundTripper (headers + timing)

  • Posted Admin-only pprof endpoint with basic auth

  • Posted Expose build metadata for debugging deploys

  • Posted Request-scoped slog logger with JSON output (Go 1.21+)

  • Posted CORS allowlist middleware (no wildcard surprises)

  • Posted Webhook signature verification with HMAC (timing-safe compare)

  • Posted Benchmarking hot paths (allocs and throughput)

  • Posted Table-driven tests for HTTP handlers with httptest

  • Posted Feature flag snapshot with periodic refresh and atomic reads

  • Posted Presigned S3 upload URLs (AWS SDK v2)

  • Posted Row-level locking with SELECT ... FOR UPDATE in a transaction

  • Posted Optimistic locking with a version column

  • Posted Password hashing with bcrypt and a calibrated cost

  • Posted Config parsing with env defaults and strict validation

  • Posted Consistent JSON responses (content-type + error envelopes)

  • Posted ETag handling for conditional GETs (cheap caching)

  • Posted Server-Sent Events (SSE) with heartbeats and client cleanup

  • Posted Concurrency limiting with a context-aware semaphore

  • Posted Circuit breaker around flaky dependencies

  • Posted HTTP server timeouts that prevent slowloris and stuck connections

  • Posted Safe dynamic SQL with squirrel (optional filters, stable ordering)

  • Posted pgxpool initialization with max connections and statement timeout

  • Posted Prometheus metrics middleware capturing status + duration

  • Posted OpenTelemetry tracer provider with ratio-based sampling

  • Posted gRPC unary interceptor for auth and timing logs

  • Posted JWT verification with cached JWKS (handles key rotation)

  • Posted Safe multipart uploads using temp files (bounded memory)

  • Posted Streaming JSON decoding with DisallowUnknownFields

  • Posted Gzip compression middleware with correct Vary header

  • Posted Panic recovery middleware for HTTP servers

  • Posted Error wrapping that stays inspectable with errors.Is and errors.As

  • Posted Readiness and liveness probes with dependency checks

  • Posted Cursor pagination: opaque tokens with stable ordering

  • Posted Singleflight cache fill to prevent thundering herd

  • Posted HTTP client tuned for production: timeouts, transport, and connection reuse

  • Posted Postgres transaction pattern with pgx: defer rollback, commit explicitly

  • Posted Exponential backoff with jitter for retries

  • Posted Token bucket rate limiter for outbound calls

  • Posted Bounded worker pool with backpressure

  • Posted Fan-out with errgroup and shared cancellation

  • Posted Graceful shutdown: draining HTTP + background workers

  • Posted HTTP handler with timeouts, request IDs, and context cancellation

CodeSnips

CodeSnips is crafted with passion and great attention to detail.

We are 0 coders making 0 comments on 0 code snips.

Privacy Terms
Facebook Instagram Pinterest
Collections Coders Tags

© 2024 CodeSnips. All Rights Reserved. Running on Ruby on Rails.

Disclaimer: Any posts on CodeSnips.io are posted by individuals acting in their own right and do not necessarily reflect the views of CodeSnips.
CodeSnips will not be held liable for the actions of any user.