This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git-related functions and aliases | |
parse_git_head () { | |
git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)# (git::\1)#' | |
} | |
function get_statuscolor { | |
if [[ "$(git status 2> /dev/null | tail -n1)" != "nothing to commit, working directory clean" ]] | |
then | |
echo $RED | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN; | |
CREATE TABLE cities | |
( | |
id serial PRIMARY KEY, | |
name varchar(255), | |
allows_drones boolean | |
); | |
CREATE TABLE stores | |
( | |
id serial PRIMARY KEY, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tacoRank(taco){ | |
... | |
} | |
function findBestTacos(rankingFunction, restaurants) { | |
return restaurants.reduce((acc, next) => { return acc.concat(next.tacos) }, []) | |
.sort((a, b) => { rankingFunction(a) - rankingFunction(b) }) | |
.slice(0, 10); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tacoRank(t){ | |
... | |
} | |
function findBestTacos(restaurants) { | |
return restaurants.reduce((acc, next) => { return acc.concat(next.tacos) }, []) | |
.sort((a, b) => { tacoRank(a) - tacoRank(b) }) | |
.slice(0, 10); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bradRank(){ | |
... //rate beef tongue very highly | |
} | |
function findBestTacos(rankingFunction, restaurants) { | |
return restaurants.reduce((acc, next) => { return acc.concat(next.tacos) }, []) | |
.sort((a, b) => { rankingFunction(a) - rankingFunction(b) }) | |
.slice(0, 10); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getTotal(lineItems, state) { | |
let subtotal = lineItems.reduce((total, lineItem) => { | |
return total += lineItem.total | |
}); | |
return subtotal + salesTax(state, subtotal)); | |
} | |
function salesTax(state, subtotal) { | |
switch(state) { | |
case 'ak': return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//function injection again | |
function getTotal(lineItems, taxFunc) { | |
let subtotal = lineItems.reduce((total, lineItem) => { | |
return total += lineItem.total | |
}); | |
return subtotal + taxFunc(subtotal)); | |
} | |
//function factory | |
function salesTaxFunc(state) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git tag archive/<branchname> <branchname> | |
git branch -d <branchname> | |
#checkout archived branch | |
git checkout -b <branchname> archive/<branchname> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-keygen -t rsa -C "your_email@example.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git merge --no-commit --no-ff $BRANCH |
OlderNewer