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.
Playing a sound with the Web Audio API
A React hook to play a sound when a timer endsTypeScriptReactWeb Audio APIAuthorization module in Elixir
A naive authorization module that works for me at the momentElixirAuthorizationAuto-hide Phoenix flash messages
Enhancing the core Flash component with a simple JavaScript hookElixirPhoenixJavaScriptUsing Basic Auth middleware with Next.js
Simple, drop-in middleware for adding basic auth to your Next.js appNext.jsTypeScriptMiddlewareUsing Basic Auth with Remix
No need to pay for a simple password-protected website, use the platformRemixReactAuthenticationGenerating a base64 blurred placeholder image
The utility I use for my placeholder imagesTypeScriptImage ProcessingDomain Model with Zod & FP-TS
Simple domain model with Zod and FP-TS for a User entityFP-TSTypeScriptFP-TS partition
Partitioning an array of users based on a predicate using FP-TSFP-TSTypeScriptFP-TS ReaderTaskEither
Using ReaderTaskEither to interact with a database in FP-TSFP-TSTypeScriptNominal types
Using nominal types to create type-safe identifiersTypeScriptRate Limiter Service in Elixir
Custom rate limiter service using ETS and GenServerElixirRate-limiterETSGen-serveruseCopy
A simple TypeScript hook for copying text to the clipboard with a timeoutReactReact HooksuseDebounce
A simple TypeScript hook for debouncing a value with a timeoutReactReact HooksuseNavigatorOnline
Detecting online/offline status using React HooksReactReact HooksuseObservable
A simple TypeScript hook for subscribing to a BehaviorSubject with React HooksReactReact HooksusePrevious
The utility I use to get the previous value of a propReactReact Hooks