View webpack-first-error.sh
webpack | awk '/ERROR/{f=1} f{print; if (/@/) exit}'
View json.sh
#!/usr/bin/env bash
# example usage:
#
# json_response="$(curl --flag http://whatever.man)" # -> { "status": 22, "errors": [ { "message": "oh no!" } ] }
# errors="$(echo "$json_response" | json_get "errors")"
# [[ $errors ]] && {
# msg="$(echo "$errors" | json_get "0" | json_get "message")"
# }
json_get() {
View pull_request.sh
#!/usr/bin/env bash
pull_request() {
local to_branch="$1"
if [ -z $to_branch ]; then
to_branch="master"
fi
local access_token="[some access token with lots of characters]"
View show-ansi-colors.sh
#!/usr/bin/env sh
usage() {
echo "show-ansi-colors <n>"
exit 0
}
(( $# < 1 )) && usage
show_ansi_colors() {
View utf.sh
#!/usr/bin/env sh
utf_encode() {
printf "\\\x%s" $(printf "$1" | xxd -p -c1 -u)
}
utf_decode() {
printf "%b" "$1"
}
View difftree
#!/usr/bin/env bash
diff <(tree -C "$1") <(tree -C "$2")
View app.html
<template>
<h3>messages</h3>
<p>${messages.length}</p>
<p>${messages}</p>
<div repeat.for="i of messages.length">
<input type="text" value.bind="$parent.messages[i]" input.delegate="onMessageChanged(i)">
</div>
</template>
View grunt-sass-replace.js
// this is a configuration file for grunt-string-replace plugin
// todo - turn this into a proper grunt plugin of its own
module.exports = function (grunt) {
var config = {
sass: {}
},
View colors
#!/usr/bin/env bash
echo -e "\033[0mNC (No color)"
echo -e "\033[1;37mWHITE\t\033[0;30mBLACK"
echo -e "\033[0;34mBLUE\t\033[1;34mLIGHT_BLUE"
echo -e "\033[0;32mGREEN\t\033[1;32mLIGHT_GREEN"
echo -e "\033[0;36mCYAN\t\033[1;36mLIGHT_CYAN"
echo -e "\033[0;31mRED\t\033[1;31mLIGHT_RED"
echo -e "\033[0;35mPURPLE\t\033[1;35mLIGHT_PURPLE"
echo -e "\033[0;33mYELLOW\t\033[1;33mLIGHT_YELLOW"
View npm-commons.sh
#!/usr/bin/env bash
##################################
# functions for common npm tasks #
##################################
##### public #####