developer

How do JavaScript closures work?

Question: ❓❓❓ How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves? I have seen the Scheme example given on Wikipedia, but unfortunately it did not help. Good Answer: 👌👌👌 Read more…

By admin, ago
developer

How to modify existing, unpushed commits?

Question: ❓❓❓ I wrote the wrong thing in a commit message. Alternatively, I’ve forgotten to include some files. How can I change the commit message/files? The commit has not been pushed yet. Good Answer: 👌👌👌 Amending the most recent commit message git commit --amend will open your editor, allowing you Read more…

By admin, ago
developer

What is the correct JSON content type?

Question: ❓❓❓ I’ve been messing around with JSON for some time, just pushing it out as text and it hasn’t hurt anybody (that I know of), but I’d like to start doing things properly. I have seen so many purported “standards” for the JSON content type: application/json application/x-javascript text/javascript text/x-javascript Read more…

By admin, ago
developer

How to undo the last commits in Git?

Question: ❓❓❓ I committed by accident the wrong files into Git, but I haven’t pushed the commit to the server yet. How can I undo those commits? Good Answer: 👌👌👌 Undo a commit and redo $ git commit -m "Something terribly misguided" (1) $ git reset HEAD~ (2) << edit Read more…

By admin, ago