Code Snippets
If I feel that a bite-sized snippet can be useful to someone else, I jot it down. Feel free to use them in your projects, and contact me if something is wrong.
- TypeScript· React· Web Audio API
Playing a sound with the Web Audio API
A React hook to play a sound when a timer ends - Elixir· Authorization
Authorization module in Elixir
A naive authorization module that works for me at the moment - Elixir· Phoenix· JavaScript
Auto-hide Phoenix flash messages
Enhancing the core Flash component with a simple JavaScript hook - Next.js· TypeScript· Middleware
Using Basic Auth middleware with Next.js
Simple, drop-in middleware for adding basic auth to your Next.js app - Remix· React· Authentication
Using Basic Auth with Remix
No need to pay for a simple password-protected website, use the platform - TypeScript· Image Processing
Generating a base64 blurred placeholder image
The utility I use for my placeholder images - FP-TS· TypeScript
Domain Model with Zod & FP-TS
Simple domain model with Zod and FP-TS for a User entity - FP-TS· TypeScript
FP-TS partition
Partitioning an array of users based on a predicate using FP-TS - FP-TS· TypeScript
FP-TS ReaderTaskEither
Using ReaderTaskEither to interact with a database in FP-TS - TypeScript
Nominal types
Using nominal types to create type-safe identifiers - Elixir· Rate-limiter· ETS· Gen-server
Rate Limiter Service in Elixir
Custom rate limiter service using ETS and GenServer - React· React Hooks
useCopy
A simple TypeScript hook for copying text to the clipboard with a timeout - React· React Hooks
useDebounce
A simple TypeScript hook for debouncing a value with a timeout - React· React Hooks
useNavigatorOnline
Detecting online/offline status using React Hooks - React· React Hooks
useObservable
A simple TypeScript hook for subscribing to a BehaviorSubject with React Hooks - React· React Hooks
usePrevious
The utility I use to get the previous value of a prop