Skip to content

Instantly share code, notes, and snippets.

View tanepiper's full-sized avatar

Tane Piper tanepiper

View GitHub Profile
import org.json.*;
import java.net.*;
import java.util.Iterator;
PImage bg;
JSONObject data;
double west = -3.414001;
double east = -3.017120;
@tanepiper
tanepiper / gist:1887182
Created February 22, 2012 20:54 — forked from axelav/gist:1839777
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@tanepiper
tanepiper / gist:1884587
Created February 22, 2012 12:18
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+X delete line
Ctrl+↩ insert line after
Ctrl+⇧+↩ insert line before
Ctrl+⇧+↑ move line (or selection) up
@tanepiper
tanepiper / html5video.sh
Created February 14, 2012 12:14 — forked from jamesbjackson/html5video.sh
automated conversion of a file to all three html5 compatible video formats - h.264, ogg, and webm
#!/bin/sh
####################################
# Output file for HTML5 video #
# Requirements: #
# - handbrakecli #
# - ffmpeg #
# - ffmpeg2theora #
# #
# usage: #
@tanepiper
tanepiper / stagecoach.markdown
Created February 4, 2012 01:39
hypothetical stagecoach cluster management commands

commands

remote

Save hub locations and passwords by name. Inspired by git remote.

$ stagecoach remote add mysite --hub=localhost:6000 --password=beepboop
#!/usr/bin/env node
var util = require('util'),
http = require('http'),
events = require('events'),
oauth = require('oauth').OAuth,
fs = require("fs"),
crypto = require("crypto"),
ws = require('websocket-server');
@tanepiper
tanepiper / clarg.md
Created January 4, 2012 15:50 — forked from pksunkara/clarg.md
Command Line Arguments Specification

Command Line Arguments Specification

This specification defines Command Line Arguments level 1 (CLARG 1.0). This document aims to direct development of command line tools conform to a set of rules while parsing options.

Arguments

The different type of arguments are:

  • Short Option
  • Long Option
@tanepiper
tanepiper / ms.js
Created December 21, 2011 00:45 — forked from rauchg/ms.md
/**
# ms.js
No more painful `setTimeout(60 * 4 * 3 * 2 * 1 * Infinity * NaN * '☃')`.
ms('2d') // 172800000
ms('1.5h') // 5400000
ms('1h') // 3600000
ms('1m') // 60000
@tanepiper
tanepiper / custom-dnode-session.js
Created December 10, 2011 13:50 — forked from sorensen/custom-dnode-session.js
DNode/Express Mongoose Authentication
// DNode Session
// =============
var connect = require('connect')
module.exports = function(opt) {
var key = opt.key || 'connect.sid'
, store = opt.store
, interval = opt.interval || 120000
@tanepiper
tanepiper / dnode-auth.js
Created December 8, 2011 23:09 — forked from sorensen/custom-dnode-session.js
Mongoose Authentication
// Authentication middleware
// -------------------------
// Shim for DNode's current version of socket.io,
// which cannot pass `null` references, and turning
// the mongoose model to a pure JSON object
function shim(err, doc, fn) {
if (!err) err = 0
if (doc) doc = JSON.parse(JSON.stringify(doc))