title | subtitle | author | date | source |
---|---|---|---|---|
npm vs Yarn Command Translation Cheat Sheet |
CLI commands comparison |
yarn |
February 15, 2020 |
Based on this blogpost.
Install with Homebrew:
$ brew install postgresql
Run server:
------------------------------------------------------------------------------------------------------------------------------------------------- | |
$ bash --version #bash acronym for "Bourne Again Shell" | |
$ man bash | grep -C2 '$@' #"$@" as explained below under Special Parameters | |
----------------------------------------------------------------------------------------------------- | |
#Current Shell | |
$ echo $SHELL | |
$ echo $0 | |
$ readlink /proc/$$/exe | |
$ cat /proc/$$/cmdline |
git filter-branch --env-filter ' | |
WRONG_EMAIL="email-to-override.com" | |
NEW_NAME="New Name" | |
NEW_EMAIL="new-email.com" | |
if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ] | |
then | |
export GIT_COMMITTER_NAME="$NEW_NAME" | |
export GIT_COMMITTER_EMAIL="$NEW_EMAIL" | |
fi |
How do you decide, how do you choose between these three based on the purpose/size/props/behaviour of our components? Extending from React.PureComponent or from React.Component with a custom shouldComponentUpdate method have performance implications. Using stateless functional components is an "architectural" choice and doesn't have any performance benefits out of the box (yet).
For simple, presentational-only components that need to be easily reused, prefer stateless functional components. This way you're sure they are decoupled from the actual app logic, that they are dead-easy to test and that they don't have unexpected side effects. The exception is if for some reason you have a lot of them or if you really need to optimise their render method (as you can't define shouldComponentUpdate for a stateless functional component).
Extend PureComponent if you know your output depends on si
Depending upon the browser the scroll event can fire a lot and putting code in the scroll callback will slow down any attempts to scroll the page (not a good idea). Any performance degradation in the scroll handler(s) as a result will only compound the performance of scrolling overall. Instead it’s much better to use some form of a timer to check every X milliseconds OR to attach a scroll event and only run your code after a delay (or even after a given number of executions – and then a delay).
It’s not clear why Twitter decided to re-query the DOM every single time the scroll event fired, but this does not appear to be necessary (since scrolling itself didn’t change the DOM). They could’ve saved the result of that single query to a variable and looked it up whenever they wanted to re-use. This would’ve resulted in absolutely no querying overhead (whic