Skip to content

Instantly share code, notes, and snippets.

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@boucher
boucher / StripeTutorialPage.html
Created February 6, 2012 07:05
Stripe Tutorial Payment Form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
// this identifies your website in the createToken call below
@CasualSuperman
CasualSuperman / indexBy.js
Created December 22, 2011 17:58
Underscore.js indexBy mixin
/**
* Underscore function that combines _.find and _.indexOf
* Source: https://github.com/documentcloud/underscore/issues/413
*
* _.indexBy([2, 6, 4, 7, 9, 0], function(num) {
* return num % 2 === 1;
* });
* => 3
*/
@creationix
creationix / coroutine-example.js
Created November 8, 2011 22:14
Lua style coroutines in nodeJS proposal
var FS = require('fs');
var Fiber = require('./fiber'); // Not to be confused with the existing node-fibers module
// readFile is a normal non-blocking, async function, but internally it can use
// the coroutine helper fiber. These kinds of coroutines are no more dangerous
// to the caller than any other async function.
function readfile(filename, next) {
// The call to Fiber is non-blocking. It's contents are only run sync till
// the first call to wait and then it returns.
Fiber(function (resume, wait) {
@isaacs
isaacs / streams.md
Created September 26, 2011 00:58
A spec for streams

Status of this Document

This is a proposal. It does not match the code as of writing.

This describes the minimum contract that Stream objects must adhere to in order to properly interoperate with pipes.

Stream Class

The parent class for all stream objects. Implements the pipe

@RandomEtc
RandomEtc / modestmaps-static.js
Created August 23, 2011 06:52
Node.js server for composing map tiles using modestmaps.js
var MM = require('modestmaps'),
Canvas = require('canvas'),
Image = Canvas.Image;
get = require('get'),
express = require('express');
function renderStaticMap(provider, dimensions, zoom, location, callback) {
var canvas = new Canvas(dimensions.x, dimensions.y),
ctx = canvas.getContext('2d');
@devongovett
devongovett / gist:1039559
Created June 22, 2011 05:27
JSONDB implementation
###
# JSONDB - a compressed JSON format
# By Devon Govett
# Originally proposed by Peter Michaux - http://michaux.ca/articles/json-db-a-compressed-json-format
#
# jsondb.pack converts an array of objects with the same keys (i.e. from a database)
# and flattens them into a single array, which is much smaller than the pure json
# representation where the keys are repeated for each item in the array.
# Combine with JSON.stringify to send compressed JSON data over the network.
#
@dshaw
dshaw / module.js
Created June 22, 2011 05:01 — forked from creationix/module.js
A super simple module system for browsers. Assumes all source files are concatenated and in browser.
function define(name, fn) {
if (!defs) { defs = {}; }
defs[name] = fn;
}
function require(name) {
console.log("Loading " + name);
if (modules && modules.hasOwnProperty(name)) return modules[name];
if (defs && defs.hasOwnProperty(name)) {
if (!modules) { modules = {}; }
var fn = defs[name];
@sfoster
sfoster / gist:1018660
Created June 10, 2011 11:36
Screenshot sequence w. node.js and screencapture
(function(){
var sys = require('sys');
var filestem = process.ARGV.length > 2 ? process.ARGV.length[2] : "screen";
var spawn = require('child_process').spawn,
timer = null,
startTime, stopTime;
function outfile(d) {
@coolaj86
coolaj86 / fs.extra.js
Last active May 22, 2022 22:45
fs.copy and fs.move for Node.JS
/*
UPDATE: this has finally been pushed to npm as `fs.extra`
URL: https://github.com/coolaj86/utile-fs/tree/master/fs.extra
*/
(function () {
"use strict";
console.warn('[Deprecated] See https://github.com/coolaj86/utile-fs');
var fs = require('fs')