#math 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
PHP Haversine Distance Between Two Coordinates
Compute the great-circle distance between two latitude/longitude points using the haversine formula. Returns kilometers; multiply by 0.621 for miles. Useful for "stores near me" features.
TypeScript Sum / Mean / Median (numeric arrays)
The descriptive-stat trio for number[]. Median sorts a copy so the input is left alone. Empty input returns 0 / 0 / 0 rather than NaN — opinionated, but predictable.
PHP RGB ↔ Hex Conversion
Two-way conversion between #RRGGBB hex strings and [R, G, B] arrays. Handy when working with theme colors that come from both sources (CSS strings vs. RGB sliders).
PHP Compound Interest Calculator
Compute the future value of an investment compounded n times per year for t years. Returns both the final value and the interest earned.
PHP Number to Ordinal (1st, 2nd, 3rd)
Convert an integer to its English ordinal form ("1st", "2nd", "3rd", "11th", "22nd", "103rd"). Pure rule-based; no library needed.
PHP Average / Median / Mode
Three classic descriptive statistics over a numeric array. Built without any external math library — just sort + count.
TypeScript clamp / lerp / mapRange
Three numeric utilities you reach for constantly in animation, UI math, and audio code. Generic enough to use anywhere, no Math.* dance required.
Bash Sum a Column with awk
Awk's default field splitter is whitespace; pass a single character with -F. Perfect for summing the Nth column of a log file or CSV.