Tiny binary search done with 109 bytes of JavaScript.
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
pr() { | |
local _open=$(if [[ `uname -s` == "Linux" ]]; then echo "xdg-open"; else echo "open"; fi) | |
local repo=`git config --get remote.origin.url | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"` | |
local branch=`git rev-parse --abbrev-ref HEAD` | |
$_open https://github.com/$repo/pull/new/$branch | |
} |
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
# Print http status every n seconds | |
# n defaults to 1s | |
# usage: | |
# http-ping google.com .5 (500 milliseconds) | |
# http-ping google.com 2 (2 seconds) | |
http-ping() { | |
n=1 && (($#>1)) && n=$2 | |
while true | |
do | |
curl -o /dev/null --silent --head --write-out '%{http_code}\n' $1 |
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
# usage docker-enter [CONTAINER_ID] | |
dockerenter() { | |
docker exec -it $1 bash | |
} | |
alias docker-enter=dockerenter |
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
<!doctype html> | |
<script>function t(s,d){for(var k in d)s=s.replace(new RegExp('{{\\s*'+k+'\\s*}}','g'),d[k]);return s;}</script> | |
<script type="template" id="tmpl"> | |
<h1>Hello {{ name }}!</h1> | |
</script> | |
<script> | |
var tmpl = document.getElementById('tmpl').innerHTML; |
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
#!/usr/bin/env bash | |
# checks if branch has something pending | |
function parse_git_dirty() { | |
git diff --quiet --ignore-submodules HEAD 2>/dev/null; [ $? -eq 1 ] && echo "*" | |
} | |
# gets the current git branch | |
function parse_git_branch() { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" |
NewerOlder