Elixir Examples

ElixirOct 23, 2026

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.

formattingtablescli
000
ElixirOct 23, 2026

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.

validationencodingbase64
000
ElixirOct 23, 2026

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.

errorsvalidationforms
000
ElixirOct 23, 2026

Elixir URL query string builder and parser

Encodes maps and list-valued parameters into query strings, then trims a leading question mark before parsing.

query-stringurlencoding
000
ElixirOct 23, 2026

Elixir JSON parsing with descriptive failures

Wraps JSON decoding with tagged failures and a shape check for code that expects a top-level object.

parsingerrorsjson
000
ElixirOct 23, 2026

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.

concurrencyworker-pooltasks
000
ElixirOct 23, 2026

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.

timeoutshttpjson
000
ElixirOct 23, 2026

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.

environmentconfigurationvalidation
000
ElixirOct 23, 2026

Bounded LRU cache with explicit Elixir state

Implements a bounded least-recently-used cache as an immutable map, returning evicted keys whenever capacity overflows.

boundedlrucache
000
ElixirOct 23, 2026

Immutable token bucket rate limiter in Elixir

A refillable token bucket that allows short bursts while enforcing an average request rate using monotonic time.

concurrencytoken-bucketrate-limiting
000
ElixirOct 23, 2026

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.

sortingnil-handlingcomparator
000
ElixirOct 23, 2026

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.

chunkenumerablebatch
000
ElixirOct 23, 2026

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.

streamsiofiles
000
ElixirOct 23, 2026

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.

mapsrecursionimmutabilitydeep-merge
000
ElixirOct 23, 2026

Capped exponential backoff retry in Elixir

Runs a function with capped exponential backoff and jitter, retrying failures until a maximum attempt count is reached.

resiliencebackoffretryjitter
000