How do JavaScript closures work?
A closure is a function plus the scope it was created in. That sentence is correct and explains nothing until you watch two of them refuse to share a variable.
How to change a Git commit message
Fixing the last commit message is one command. Fixing an older one rewrites every commit after it, which is fine while nothing has been pushed and a problem the moment it has.
How to check out a remote Git branch
A colleague pushed a branch and you want to work on it. In current git that is one command — but only after a fetch, and only if you avoid the one form that leaves you on no branch at all.
How to concatenate two lists in Python
There are five reasonable ways to join two lists. They differ in whether you get a new list or modify an existing one, and that difference is visible to other code holding the same list.
How to convert a string to a boolean in JavaScript
The reason this question has 111 answers is one line:
Boolean("false") = true
How to copy a file in Python
shutil offers four functions for this and they differ in what they carry
across. As of Python 3.14 there is also a pathlib method, which every answer
written before then predates.
How to create a UUID in JavaScript
There is a built-in for this now, so the answer is one line. The part worth
reading is why the Math.random() one-liner that still circulates produces
something that looks identical and is not.
How to deep clone an object in JavaScript
There is a built-in for this now — structuredClone. The question was asked in
2008 and got the answer it deserved at the time; the interesting part today is
what each option quietly does to your data.
How to delete a Git branch locally and remotely
A branch exists in up to three places: on your machine, on the remote, and as a remote-tracking ref that remembers what the remote looked like last time you asked. Deleting it properly means dealing with all three.
How to force git pull to overwrite local files
You have local edits, the remote has moved on, and you want the remote’s
version — all of it, yours discarded. git pull refuses, so the obvious next
move is to add --force. That does not work, and it is worth seeing why.