Format bytes as a human-readable size
Convert a byte count into KB, MB, GB and so on with a configurable number of decimals.
Loading snippets…
137 snippets
Convert a byte count into KB, MB, GB and so on with a configurable number of decimals.
Convert a number of bytes to KB, MB or GB with a chosen precision.
Convert a byte count into a short human-readable size such as 1.5 MB.
Show a clear focus outline for keyboard users without drawing it on mouse clicks.
Scale font size smoothly between a minimum and maximum as the viewport grows, with no media queries.
Flatten arbitrarily nested lists and tuples into a single flat iterator, leaving strings intact.
Flatten arrays to any depth with a small recursive helper that mirrors Array.prototype.flat.
Turn nested dicts into a single-level dict with dotted keys, handy for config and logging.
Produce a row for every day in a range and left join your data so days with no activity show zero.
Safely remove old log or temp files with find, previewing first and handling unusual filenames.
A fetch wrapper that throws on HTTP errors and validates the JSON body with a type guard.
A short helper around htmlspecialchars with the right flags for HTML text and attribute values.