Hash and verify passwords in PHP
Store passwords with password_hash and check them with password_verify, including rehash on login.
Loading snippets…
137 snippets
Store passwords with password_hash and check them with password_verify, including rehash on login.
Build an object of arrays keyed by a property or computed value, using Object.groupBy or a reduce fallback.
Turn a date into a localized relative string using Intl.RelativeTimeFormat, with no library.
List values that appear more than once with GROUP BY and HAVING, including how many times.
Abort slow HTTP requests with AbortSignal.timeout and turn non-2xx responses into real errors.
Clean up merged local branches safely, excluding main, master, develop and the current branch.
Remove duplicates in PostgreSQL using ROW_NUMBER over a partition, keeping one row per key.
Delay a function call until the caller has stopped invoking it for a given time, with cancel support.
Switch themes by redefining variables under prefers-color-scheme, with a manual override attribute.
Tokenize text and list the most common words using collections.Counter.
Use the async Clipboard API with a legacy fallback and report success or failure to the user.
Yield fixed-size lists from a list, generator or file without loading everything into memory.