What are first-class functions?
A programming language is said to have first-class functions if it supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data strucures.
References
- https://en.wikipedia.org/wiki/First-class_function
What is a Debounce function?
Debounce function returns a function that as long as it continues to be invoked, will not be triggered. The function will be called after it stops being called for N milliseconds.
A debounce is a cousin of the throttle, and they both improve the performance of web applications. A debounce is utilized when you only care about the final state. For example, waiting until a user stops typing to fetch typeahead search results.
// Code from https://davidwalsh.name/javascript-debounce-function
var myEfficientFn = debounce(function() {
// All the taxing stuff you do
}, 250);
window.addEventListener('resize', myEfficientFn);
The myEfficientFn will not be called until 250 milliseconds has passed since the last resize event.
References
- https://davidwalsh.name/javascript-debounce-function
- https://levelup.gitconnected.com/debounce-in-javascript-improve-your-applications-performance-5b01855e086
.bash_profile vs .bashrc
.bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells.
References
- http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html
How to delete a Git branch both locally and remotely?
To delete the local branch use:
$ git branch -d branch_name
To delete the remote branch use:
$ git push origin --delete <branch_name>
References
- http://stackoverflow.com/questions/2003505/how-to-delete-a-git-branch-both-locally-and-remotely
What is the difference between CSS word-break vs word-wrap?
overflow-wrap (word-wrap) and word-break behave very similarly and can be used to solve similar problems. word-break is best used with non-English content that require specific word-breaking rules. overflow-wrap can be used regardless of language used.
References
- https://css-tricks.com/almanac/properties/w/word-break/
- https://css-tricks.com/almanac/properties/w/word-break/
- https://css-tricks.com/almanac/properties/w/whitespace/
- http://stackoverflow.com/questions/1795109/what-is-the-difference-between-word-break-break-all-versus-word-wrap-break/