Deep Copy in JavaScript: structuredClone vs JSON and Spread
Spread copies one level, the JSON trick breaks dates, maps and cycles, and structuredClone() fixes most of it. Tested examples, including what it still cannot clone.
Category
Notes on programming languages: PHP, Python, JavaScript and the tools around them, with tested examples.
Spread copies one level, the JSON trick breaks dates, maps and cycles, and structuredClone() fixes most of it. Tested examples, including what it still cannot clone.
Two small functions that stop search boxes and scroll handlers from running too often, with a runnable timeline that shows exactly when each one fires.
Why I convert os.system() calls to subprocess.run(): no shell injection, real exit codes, captured output, timeouts and input, with notes for Python 3.6.
?->, ?? and ??= all deal with null, but they solve different problems. Tested examples of each, short-circuiting, and the places where ?-> is not allowed.
How I use python -m venv on servers and laptops: one environment per project, pinned requirements, no activation in cron, and why .venv never goes into Git.
match looks like a shorter switch, but it compares strictly, never falls through, returns a value and throws when nothing matches. Here is what that means in practice.
amend, reset --soft, --mixed, --hard, revert and restore each undo something different. A tested walk-through, plus how the reflog recovers from a bad reset.