Elixir Examples
Plain-text CLI table renderer for Elixir
Computes column widths from headers and rows, then renders a padded plain-text table with a dashed divider.
Elixir Base64 encode and decode with errors
Encodes binary data as standard Base64 and decodes padded or unpadded input, returning tagged errors for bad data.
Field-level Elixir input validation with error maps
Validates a params map field by field and returns either the params or a map of human-readable errors.
Elixir URL query string builder and parser
Encodes maps and list-valued parameters into query strings, then trims a leading question mark before parsing.
Elixir JSON parsing with descriptive failures
Wraps JSON decoding with tagged failures and a shape check for code that expects a top-level object.
Bounded Elixir worker pool via Task.async_stream
Runs a function over many items with a fixed concurrency limit, collecting each success or failure in input order.
HTTP GET JSON fetcher with timeout in Elixir
Fetches a URL with :httpc under a configurable timeout, validates the status code, and decodes the JSON response body.
Elixir env config loader with typed defaults
Loads environment variables against a typed spec, applying defaults and returning precise errors for missing or invalid values.
Bounded LRU cache with explicit Elixir state
Implements a bounded least-recently-used cache as an immutable map, returning evicted keys whenever capacity overflows.
Immutable token bucket rate limiter in Elixir
A refillable token bucket that allows short bursts while enforcing an average request rate using monotonic time.
Multi-key Elixir record sort with nil-last order
Sorts maps by multiple keys in ascending order, keeps equal records stable, and places nil values last.
Chunk an Elixir enumerable into fixed batches
Splits any enumerable into lists of a fixed size, either collecting all batches or processing each one with a callback.
Lazy line-by-line text file reader in Elixir
Returns lazy streams that read a text file one line at a time, with helpers for taking a limited number of lines.
Deep copy and recursive merge for Elixir maps
Recursively clones nested maps and lists, then merges maps with right-hand values taking precedence at every level.
Capped exponential backoff retry in Elixir
Runs a function with capped exponential backoff and jitter, retrying failures until a maximum attempt count is reached.