start new:
tmux
start new with session name:
tmux new -s myname
| # http://henrik.nyh.se/2008/12/git-dirty-prompt | |
| # http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
| # username@Machine ~/dev/dir[master]$ # clean working directory | |
| # username@Machine ~/dev/dir[master*]$ # dirty working directory | |
| function parse_git_dirty { | |
| [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
| } | |
| function parse_git_branch { | |
| git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.| ######################################## | |
| # # | |
| # Important Note # | |
| # # | |
| # When running calabash-ios tests at # | |
| # www.lesspainful.com # | |
| # this file will be overwritten by # | |
| # a file which automates # | |
| # app launch on devices. # | |
| # # |
| { | |
| "scripts": { | |
| "eslint": "LIST=`git diff-index --name-only HEAD | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi" | |
| }, | |
| "devDependencies": { | |
| "pre-commit": "0.0.7", | |
| "eslint": "~0.5.1" | |
| }, | |
| "pre-commit": [ | |
| "eslint" |
| #!/bin/bash | |
| # v0.0.2 | |
| # AWS Deploy Script for Travis | |
| # Remember to add the env var in the travis configuration | |
| # in order to work, this scripts needs: | |
| # AWS_ACCESS_KEY_ID: user ID | |
| # AWS_SECRET_ACCESS_KEY: user secret | |
| # APP_NAME: EBS application name | |
| # APP_ENV: EBS application env | |
| # S3_BUCKET: name of the S3 bucket to store deployment archive |
##Sass Functions Cheat Sheet
| var a = ["sdfdf", "http://oooooolol"], | |
| handleNetErr = function(e) { return e }; | |
| Promise.all(fetch('sdfdsf').catch(handleNetErr), fetch('http://invalidurl').catch(handleNetErr)) | |
| .then(function(sdf, invalid) { | |
| console.log(sdf, invalid) // [Response, TypeError] | |
| }) | |
| .catch(function(err) { | |
| console.log(err); | |
| }) |
| // the main app file | |
| import express from "express"; | |
| import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db) | |
| import authenticate from "./authentication"; // middleware for doing authentication | |
| import permit from "./authorization"; // middleware for checking if user's role is permitted to make request | |
| const app = express(), | |
| api = express.Router(); | |
| // first middleware will setup db connection |