#generator Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
Python Run sync Iterables as async Stream
Wrap a blocking iterator so each yield happens in a worker thread — useful when integrating sync libraries (DB cursors, file iterators) into an async pipeline without rewriting them.
TypeScript Date Range Generator
Yield each day (or step) between two dates as a Date object. Generator-based so consumers can `break` early without computing the whole range.
PHP Stream Large CSV with Generator
Iterate over a CSV file row-by-row without ever loading the whole file into memory. Uses a generator so consumers can foreach naturally and PHP cleans up the file handle.
PHP JSON Lines (NDJSON) Stream Reader
Read newline-delimited JSON (one object per line) as a generator. Each yield gives you the next decoded record without holding the whole file in memory.
PHP Generate Crypto-Strong Password
Generate a strong random password with configurable length and character sets. Uses rejection sampling to keep the distribution uniform across the chosen alphabet (no biased % alphabetLen).
Python Stream Large CSV with DictReader
Iterate over a CSV row-by-row as a dict — never loading the whole file. Tolerant of UTF-8 BOMs (utf-8-sig). Generator wrapper makes consumers naturally use for/break.
TypeScript range — Lazy Number Iterator
A generator-based numeric range: `[start, end)` with an optional step. Lazy so it doesn't allocate a huge array up front; consume with for…of or Array.from.
PHP Date Range Iterator
Yield each date in a [start, end] interval as a DateTimeImmutable, with a configurable step. Builds on DatePeriod under the hood — but exposes a generator so you can break out early.
PHP Recursive Directory Walker
Yield every file under a directory using a generator and SPL's RecursiveIteratorIterator. Filter by extension or any other predicate without slurping all paths into memory first.