Skip to content

Instantly share code, notes, and snippets.

@joeskeen
joeskeen / .bashrc
Created April 10, 2018 20:45
My custom shell definition
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\n\[\033[0;92m\]\u@\h\[\033[0m\] \[\033[32m\]\w\[\033[33m\]$(parse_git_branch)\[\033[00m\]\n\[\033[0;96m\]$\[\033[0m\] "
@joeskeen
joeskeen / 2promise.ts
Created February 15, 2016 10:34
Convert an asynchronous function requiring a callback parameter to a promise.
'use strict';
export async function fromNoErrCallback<TResult>(func: Function, thisArg: any, args?: any) {
return toPromise<TResult>(func, thisArg, args, createNoErrCallback);
}
export async function fromErrCallback<TResult>(func: Function, thisArg: any, args?: any) {
return toPromise<TResult>(func, thisArg, args, createErrCallback);
}