Skip to content

Code Snippets. React, TypeScript, Elixir & more

Some snippets I saved, that are not enough to be a blog post.
Slowly updating and adding more
Playing a sound with the Web Audio API
A React hook to play a sound when a timer ends
TypeScriptReactWeb Audio API
Authorization module in Elixir
A naive authorization module that works for me at the moment
ElixirAuthorization
Auto-hide Phoenix flash messages
Enhancing the core Flash component with a simple JavaScript hook
ElixirPhoenixJavaScript
Using Basic Auth with Remix
No need to pay for a simple password-protected website, use the platform
RemixReactAuthentication
Generating a base64 blurred placeholder image
The utility I was for my blog post placeholder images
TypeScriptImage Processing
Domain Model with Zod & FP-TS
Simple domain model with Zod and FP-TS for a User entity
FP-TSTypeScript
FP-TS partition
Partitioning an array of users based on a predicate using FP-TS
FP-TSTypeScript
FP-TS ReaderTaskEither
Using ReaderTaskEither to interact with a database in FP-TS
FP-TSTypeScript
Nominal types
Using nominal types to create type-safe identifiers
TypeScript
Rate Limiter Service in Elixir
Custom rate limiter service using ETS and GenServer
ElixirRate-limiterETSGen-server
useCopy
A simple TypeScript hook for copying text to the clipboard with a timeout
ReactReact Hooks
useDebounce
A simple TypeScript hook for debouncing a value with a timeout
ReactReact Hooks
useNavigatorOnline
Detecting online/offline status using React Hooks
ReactReact Hooks
useObservable
A simple TypeScript hook for subscribing to a BehaviorSubject with React Hooks
ReactReact Hooks
usePrevious
The utility I use to get the previous value of a prop
ReactReact Hooks