Skip to content

Instantly share code, notes, and snippets.

View nguyenit67's full-sized avatar
🚀
Aim for the best 💪💪💪

Nguyen Hoang Nguyen nguyenit67

🚀
Aim for the best 💪💪💪
View GitHub Profile
@nguyenit67
nguyenit67 / useEffect.js
Last active July 27, 2021 09:02
react Hooks
componentDidMount() {
}
componentDidUpdate() {
}
componentWillUnmount() {
@nguyenit67
nguyenit67 / git-bash.sh
Created July 21, 2021 09:30
git: apply stash when conflict
$ git reset --merge
https://stackoverflow.com/a/60444590
@nguyenit67
nguyenit67 / git-bash.sh
Last active July 19, 2021 16:33
Git show what changes has made of a commit use git-log
Show the last N commits from a certain author:
$ git log -n number --author=author
For example:
# (changes in latest commit)
$ git log --stat -n 1
# git-whatchanged show little more detail of all changes happened
$ git whatchanged
# use $(pwd) instead of $PWD because $PWD is just a variable for display purpose
# not actually change (cd) current working directory
~/dev/MyRepo$ PWD=~/dev/
~/dev$
~/dev$ $PWD
bash: /home/Nashu/dev/: Is a directory
~/dev$ pwd
@nguyenit67
nguyenit67 / script.js
Created June 29, 2021 05:47
Array.prototype.flatMap()
let arr1 = ["it's Sunny in", "", "California"];
arr1.map(x => x.split(" "));
// [["it's","Sunny","in"],[""],["California"]]
arr1.flatMap(x => x.split(" "));
// ["it's","Sunny","in", "", "California"]
@nguyenit67
nguyenit67 / functions.php
Last active June 1, 2021 07:46
Custom Menu In WordPress
<?php register_nav_menus( [ 'primary' => __( 'Primary Menu' ) ] ); ?>