I hereby claim:
- I am tgallacher on github.
- I am tgallacher (https://keybase.io/tgallacher) on keybase.
- I have a public key ASAo0nB6NZAxdEu6lz_ZvG_v6xpz1tnSEjBp_4SPwFehAwo
To claim this, I am signing this object:
# Clean up branches which no longer exist on the remote | |
# | |
# @tip: Add to bash/zsh aliases | |
# @note: split over multiple lines to make it easier to read. | |
# @see: https://gist.github.com/tgallacher/cae12db973a235b52e9e5b014d21d633 | |
git fetch && \ | |
git remote prune origin && \ | |
git branch -v | \ | |
grep gone | \ | |
awk '{print $1;}' | \ |
alias.co=checkout | |
alias.ci=commit | |
alias.st=status -s | |
alias.br=branch | |
alias.last=log -1 HEAD | |
# Pretty oneline log summary | |
alias.plog=log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
# Word-level diff |
# Remove merged branches from local repo. | |
alias git_prune_branches='git fetch && git remote prune origin && git br -v | grep gone | awk '"'"'{print $1;}'"'"' | xargs -n 1 git br -d' |
// Basic summary of different common sorting algorithms. | |
// This is just for reference; focus in not on micro-optimising the algo, but just generally highlighting the | |
// differences between each algorithm. | |
// | |
// Summaries from Brian Holt's CodePen's | |
// | |
// ToCs | |
// 1. Bubble Sort | |
// 2. Insertion Sort | |
// 3. Merge Sort (effectively what Array.prototype.sort uses under the hood (95% of the time)) |
I hereby claim:
To claim this, I am signing this object:
// Define our 'constant' variable | |
const data = { | |
a: 1, | |
b: 2 | |
}; | |
// Let's mutate its contents: All Perfectly acceptible! | |
data.b = 5; | |
data.d = 'foo'; | |
delete data['a']; |
function foo(){ | |
const bar = 5; | |
if(true){ | |
const bar = 100; | |
bar = 20; // TypeError: Assignment to constant variable | |
} | |
console.log(bar); // would have printed: 5 |
function foo(){ | |
let bar = 5; | |
if(true){ | |
let bar = 100; | |
} | |
console.log(bar); // prints: 5 | |
} |
function foo(){ | |
var bar = 5; | |
if(true){ | |
var bar = 100; // Even though var isn't block scoped, this doesn't throw an error! | |
} | |
console.log(bar); // prints: 100 | |
} |