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
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
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 / jeesh.js
Created November 12, 2013 22:08 — forked from clux/jeesh.js
var domready = require('domready')
, bean = require('bean') // events
, bonzo = require('bonzo') // DOM wrapper/manipulation
, request = require('superagent/superagent')
, qwery = require('qwery') // css selectors
, slice = Array.prototype.slice;
// Attach events API to the prototype of DOM wrapper:
var aug = {};
['on', 'off', 'one', 'add', 'fire', 'clone'].forEach(function (k) {
@skw
skw / video.js
Created October 23, 2013 18:22 — forked from seanhagen/video.js
describe( "Video model", function(){
var MOCK_GET_DATA = {
channelName: "tgndeveloperedu",
commentCount: 0,
defaultOrder: 0,
dislikeCount: 0,
facebookCount: "0",
googleCount: "0",
likeCount: 0,
/*jshint node:true*/
'use strict';
var path = require('path'),
url = require('url'),
when = require('when'),
ffs = require('final-fs');
var reworkRecompile = function (cssPath, reworkPath, doRework) {
return ffs.readFile(reworkPath, {encoding: 'utf-8'})
@skw
skw / less2stylus.coffee
Last active December 17, 2015 19:19 — forked from lancejpollard/less2stylus.coffee
made some changes to make it work for me
# Quick hack of regular expressions to convert twitter bootstrap from LESS to Stylus
fs = require 'fs'
less2stylus = (string) ->
string = string
.replace(/^(\ *)(.+)\ +\{\ *\n?\ */mg, "$1$2\n$1 ") # remove opening brackets
.replace(/^(\ *)([^\ \n]+)\ +\{\ *\n?\ */mg, "$1$2\n$1 ") # remove opening brackets
.replace(/\ *\{\ *\n*/g, "\n") # remove opening brackets again (some random cases I'm too lazy to think through)
.replace(/\ *\}\ *\n*/g, "\n") # remove closing brackets
@skw
skw / gist:5622844
Last active December 17, 2015 14:09 — forked from berzniz/gist:2900905
CS Fork get handle bar template function example
# get template on the fly
Handlebars.getTemplate = (name)->
if Handlebars.templates is undefined or Handlebars.templates[name] is undefined
$.ajax(
url: "/templates/" + name
success: (data) ->
Handlebars.templates = {} if Handlebars.templates is undefined
Handlebars.templates[name] = Handlebars.compile(data)
error: (xhr, options, err) ->
console.log xhr.status
@skw
skw / app.html
Last active December 16, 2015 01:39 — forked from ded/app.html
Updated Ender/script.js async js asset loading example.
<script src="ender.min.js"></script>
<script>
$script('/js/core.min.js', 'core')
$script.ready('core', function () {
$(document).ready(function () {
$('<p>hello world</p>').appendTo('body')
.bind('click', function (e) {
$script('/js/ajax.min.js', function () {