Code Snippets
A collection of useful code snippets - Serverless Functions, Node.js scripts, and CSS tricks.
Docker Compose - Node + Postgres + Redis
Production-ready docker-compose for a Node.js API with database and cache.
GitHub Actions CI Pipeline
Full CI pipeline: install, lint, type-check, test, and build on every PR.
Go Worker Pool
Concurrent worker pool pattern using goroutines and channels.
Go HTTP Server
Minimal HTTP server with routing and JSON response in Go.
Go HTTP Middleware Chain
Composable middleware pattern for logging, auth, and CORS in Go.
GraphQL Schema & Resolver
Apollo Server schema definition with typed resolvers and context.
NestJS JWT Auth Guard
JWT authentication guard with role-based access control for NestJS.
Node.js Redis Cache
Cache-aside pattern with Redis and automatic TTL expiry.
Playwright E2E Test
Page Object Model pattern with Playwright for maintainable E2E tests.
useDebounce Hook
React hook to debounce any rapidly-changing value.
TypeScript Generic API Client
Type-safe fetch wrapper with generics, error handling, and abort support.
Card rotating on hover
Creates a two sided card which rotates on hover.
Copy to clipboard
Copies a string to the clipboard. Only works as a result of user action
CRUD API Route
For use with Next.js.
Get images
Fetches all images from within an element and puts them into an array.
hashBrowser
Creates a hash for a value using the SHA-256 algorithm. Returns a promise.
HashNode
Creates a hash for a value using the SHA-256 algorithm. Returns a promise.
Json to csv
Converts an array of objects to a comma-separated values
Menu on image hover
Displays a menu overlay when the user hovers over the image.
Mouse cursor gradient
A hover effect where the gradient follows the mouse cursor.
Parse cookie
Parses an HTTP Cookie header string, returning an object of all cookie name-value pairs.
Revue
Get all subscribers.
Revue
Subscribe to a newsletter.
Spotify
Show what you're listening to.
Sticky Nav
Create a fixed navbar.
Tailwind CSS Snippets
🌟 Unleash web magic with Tailwind CSS, a lightning-fast framework! 💪 Dazzling snippets.
Navigator
Checks if the client is online or offline.
Use SSR
Checks if the code is running on the browser or the server.
UUID genertor
Generates a UUID in a browser.