Skip to content

Instantly share code, notes, and snippets.

@gjohnson
gjohnson / out.sh
Created January 30, 2014 18:54
Phantomjs warning on OSX 10.8
2014-01-30 13:52:56.614 phantomjs[15976:507] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
@gjohnson
gjohnson / ex1.js
Created February 9, 2014 21:56
etcd + co
var etcd = require('..');
var co = require('co');
co(function *() {
try {
var leader = yield etcd.leader();
console.log(leader);
} catch (err) {
console.error(err);
  1. "Internet-based application service provider, namely, hosting, managing and maintaining software for transferring modules of code from a remote registry authority to one or more computers; providing a web site featuring use of software that enables users to transfer modules of code from a remote registry authority to one or more computers; providing a web site featuring non-downloadable software for transfer modules of code from a remote registry authority to one or more computers; providing a website featuring on-line non-downloadable software that enables users to transfer modules of code from a remote registry authority to one or more computers."

http://tsdr.uspto.gov/documentviewer?caseId=sn86185685&docId=APP20140208073406#docIndex=0&page=1

  1. "Computer software for transferring modules of code from a remote registry authority to one or more computers; computer programs and computer software for transf
@gjohnson
gjohnson / app.js
Created March 13, 2014 04:02
Tacking shit onto koa context
var koa = require('koa');
var uuid = require('node-uuid');
var app = koa();
app.use(function *(next) {
yield next;
this.log('yippie');
this.body = 'yoyoyo';
});
@gjohnson
gjohnson / mandrill-verify.js
Created March 13, 2014 08:14
Express middleware for verifying a webhook from Mandrill.
var crypto = require('crypto');
var assert = require('assert');
var debug = require('debug')('mandrill-verify');
module.exports = function (config) {
assert(config, 'missing config');
assert(config.secret, 'missing secret')
assert(config.url, 'missing url');
return function (req, res, next) {

mysql-pool-cluster

A small convience layer above node-mysql's PoolCluster. It's convienent in situations where you would like load an array of hosts that may be located in a configuration file or system.

Usage

To create a pool cluster, just pass in an array of node options to the constructor. The same types of nodes that the driver supports are supported here, anonymous and identified.

The configuration options of each node are the same as the drivers, except with the addition of an id property. The id property is what is used to distingish between an anonymous and identified node.

@gjohnson
gjohnson / widgets.js
Created July 15, 2014 13:12
Amazon Payments SDK for JavaScript -- https://payments.amazon.com/developer
/**
* Version: _V1404867306_
* Copyright 2011 Amazon.com, Inc., or its Affiliates.
**/
if (!OffAmazonPayments || typeof (OffAmazonPayments) == "undefined") {
var OffAmazonPayments = {}
}
OffAmazonPayments.ZERO_TIME = (new Date()).getTime();
var __cba__buttonversion = 0;
document.write("<script type='text/javascript' src='https://images-na.ssl-images-amazon.com/images/G/01/cba/js/jquery-1.4.2.min.js'><\/script>");
# Awesome Shit -- (forgot where I got these guys from, thanks random person on the internet!)
alias idunnolol="echo -n '¯\(°_o)/¯' | pbcopy"
alias disapproval="echo -n 'ಠ_ಠ' | pbcopy"
alias fliptable="echo -n '(╯°□°)╯︵ ┻━┻' | pbcopy"
@gjohnson
gjohnson / main.go
Created August 26, 2014 14:17
Ghetto idea of optional callbacks
package main
import "fmt"
import "reflect"
func main() {
fn1 := createCallback()
fn1()
fn2 := createCallback(func() {