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 APIA React hook to play a sound when a timer ends | TypeScriptReactWeb Audio API | ||
Authorization module in ElixirA naive authorization module that works for me at the moment | ElixirAuthorization | ||
Auto-hide Phoenix flash messagesEnhancing the core Flash component with a simple JavaScript hook | ElixirPhoenixJavaScript | ||
Using Basic Auth middleware with Next.jsSimple, drop-in middleware for adding basic auth to your Next.js app | Next.jsTypeScriptMiddleware | ||
Using Basic Auth with RemixNo need to pay for a simple password-protected website, use the platform | RemixReactAuthentication | ||
Generating a base64 blurred placeholder imageThe utility I was for my blog post placeholder images | TypeScriptImage Processing | ||
Domain Model with Zod & FP-TSSimple domain model with Zod and FP-TS for a User entity | FP-TSTypeScript | ||
FP-TS partitionPartitioning an array of users based on a predicate using FP-TS | FP-TSTypeScript | ||
FP-TS ReaderTaskEitherUsing ReaderTaskEither to interact with a database in FP-TS | FP-TSTypeScript | ||
Nominal typesUsing nominal types to create type-safe identifiers | TypeScript | ||
Rate Limiter Service in ElixirCustom rate limiter service using ETS and GenServer | ElixirRate-limiterETSGen-server | ||
useCopyA simple TypeScript hook for copying text to the clipboard with a timeout | ReactReact Hooks | ||
useDebounceA simple TypeScript hook for debouncing a value with a timeout | ReactReact Hooks | ||
useNavigatorOnlineDetecting online/offline status using React Hooks | ReactReact Hooks | ||
useObservableA simple TypeScript hook for subscribing to a BehaviorSubject with React Hooks | ReactReact Hooks | ||
usePreviousThe utility I use to get the previous value of a prop | ReactReact Hooks |