Snippets
Small, reusable code snippets I keep coming back to.
Node.js2 min read
Nearby-Places Query: Bounding Box + Haversine in MySQL
A reusable pattern for 'what's near me' search on plain MySQL — a fast bounding-box pre-filter followed by an exact Haversine distance calculation, sorted and paginated in SQL.
#Node.js
Next.js3 min read
Auth Context for Next.js (Cookie-Based Sessions)
A React context wrapping an API — login, logout, signup, and password reset — that keeps the client in sync with an httpOnly session cookie by revalidating on mount.
#React
Node.js2 min read
Redis-Cached, Server-Clustered Map Pins for a Viewport
Serve map pins for whatever bounding box a user is currently viewing, cached in Redis by the exact viewport, with overlapping pins clustered in SQL before they ever leave the server.
#Node.js
React1 min read
useDebounce hook
A small generic hook for debouncing a fast-changing value — search inputs, resize handlers, anything you don't want firing on every keystroke.
#React