Skip to content

Instantly share code, notes, and snippets.

View skw's full-sized avatar

Shaun Wong skw

  • GitHub Staff
  • Calgary, AB
View GitHub Profile
watch = require('watch');
fs = require('fs');
var cmd = require('child_process').spawn('cmd'), myArgs;
console.log('watcher started');
myArgs = process.argv.slice(2);
myDir = myArgs[0];
outDir = myArgs[1] || '';
outDir = stripTrailingSlash(outDir);
@skw
skw / gist:7c41aa1ef5e05cfa7e94
Created October 29, 2014 20:22
OS X Sublime 3 CLI Setup
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
@skw
skw / html.md
Last active August 29, 2015 14:12
Javascript Style Guide

HTML Style Guide and Semanctics

Table of contents

@skw
skw / browserify.js
Created February 1, 2015 07:30
Gulp browserify watchify task(s)
"use strict";
var gulp = require('gulp');
// plugins
var plumber = require('gulp-plumber');
var uglify = require('gulp-uglify');
var notify = require('gulp-notify');
var sourcemaps = require('gulp-sourcemaps');
// deps
var source = require('vinyl-source-stream');
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@skw
skw / pullrequest.md
Last active August 29, 2015 14:27
gh ticket templates

#999

Reviewers:

  • @username1
  • @username2

Notes

  • Any relevant notes.

Changes

  • Brief summary of the changes made, in list form.

git branch --merged master | grep -v 'master$' | xargs git branch -d

@skw
skw / .gitconfig
Created November 26, 2015 00:33
Git config aliases
[alias]
st = status
ci = commit
co = checkout
br = branch
unstage = reset HEAD --
last = log -1 HEAD
cleanup = "!git branch --merged | grep -v '\\*\\|master\\|develop' | xargs -n 1 git branch -d"
@skw
skw / tree.coffee
Last active December 15, 2015 06:39
node.js coffeescript function that returns json tree representation of directory structure
fs = require 'fs' # node file system module
path = require 'path' # node path module
# returns json tree representation of directory structure
tree = (root) ->
# clean trailing '/'
root = root.replace /\/+$/ , ""
# extract tree ring if root exists
if fs.existsSync root
ring = fs.lstatSync root