Skip to content

Instantly share code, notes, and snippets.

View wongjiahau's full-sized avatar

WJH wongjiahau

  • Malaysia
View GitHub Profile
  • 🎨 when improving the format/structure of the code
  • 🚀 when improving performance
  • ✏️ when writing docs
  • 💡 new idea
  • 🚧 work in progress
  • ➕ when adding feature
  • ➖ when removing feature
  • 🔈 when adding logging
  • 🔇 when reducing logging
  • 🐛 when fixing a bug

Most of the time when I do this I checkout to a temp branch:

> git checkout -b temp-branch-name ea3d5ed039edd6d4a07cc41bd09eb58edd1f2b3a

Then after I'm done i just delete the branch

@wongjiahau
wongjiahau / script.sh
Created August 12, 2017 05:06 — forked from thimbl/script.sh
shell script to create user accounts
#!/bin/bash
ROOT_UID=0
SUCCESS=0
E_USEREXISTS=70
# Run as root, of course. (this might not be necessary, because we have to run the script somehow with root anyway)
if [ "$UID" -ne "$ROOT_UID" ]
then
echo "Must be root to run this script."
exit $E_NOTROOT
@wongjiahau
wongjiahau / Vim mnemonics and keys
Last active August 13, 2017 12:24
List of useful mnemonics for vim
W //go to next Word (separated by space)
B //Back to previous Word (separated by space)
dib //Delete inside bracket
daw //Delete a word
dtk //Delete 'till 'k'
cW //Change big word (until a whitespace is reached)
cw //Change small word (until any non-alphabet is reached)
<Ctrl-a> //Add the first number in the current line by 1
<Ctrl-x> //Xubtract the first number in the current line by 1
180<Ctrl-a> //Add the first number in the current line by 180
#Delete last commit at remote (e.g. GitHub)
git push -f origin HEAD^:master
#Delete a particular commit at local git
git reset --hard <sha1-commit-id>
#Deleting last commit locally (HEAD~1 means last commit)
git reset --hard HEAD~1
git config --global http.proxy http://1500181:960619-43-5357@proxy2.utar.edu.my:8080
@wongjiahau
wongjiahau / gist:4c4c9ac09d259edb1a3bd4ea167a5eeb
Last active October 13, 2017 07:01
Run a new instance of Chrome that disabled CORS/XSS protection
# For Windows
start chrome.exe --user-data-dir="C:/chrome-dev-session" --disable-web-security www.github.com
# For Linux
# not known yet
# For Mac
# not known yet
@wongjiahau
wongjiahau / gist:557defb6dfeff811cc446759bd11f536
Last active October 15, 2017 14:53
My gitconfig file (gitrc)
[http]
sslCAInfo = C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
[diff "astextplain"]
textconv = astextplain
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %
required = true
process = git-lfs filter-process
[credential]
[data-tippy][data-tippy-pos]::after,[data-tippy][data-tippy-pos]::before{top:auto;left:auto;margin-top:auto;transform:none}:root{--background-color:#000;--color:#fff;--timing:150ms}[data-tippy]{position:relative}[data-tippy]::after,[data-tippy]::before{position:absolute;display:block;opacity:0;font-family:sans-serif;transform:translate(-50%,0);transform-origin:top;top:100%;left:50%;pointer-events:none}[data-tippy]::before{content:attr(data-tippy);color:var(--color);font-size:14px;background-color:var(--background-color);z-index:1;padding:3px 6px;border-radius:3px;white-space:nowrap;margin-top:10px;font-weight:400}[data-tippy]::after{content:'';border:5px solid transparent;border-bottom-color:var(--background-color)}[data-tippy]:hover::after,[data-tippy]:hover::before{transform:translate(-50%,0);opacity:1}[data-tippy][data-tippy-pos]::after{border-bottom-color:transparent}[data-tippy][data-tippy-pos=up]::after,[data-tippy][data-tippy-pos=up]::before,[data-tippy][data-tippy-pos=down]::after,[data-tippy][data-ti
git init
npm init
mkdir ts
cd ts
tsc --init
tslint --init
touch app.ts