Skip to content

Instantly share code, notes, and snippets.

View bsstoner's full-sized avatar

Brian Stoner bsstoner

View GitHub Profile
@bsstoner
bsstoner / http.js
Created May 21, 2012 03:30
support helper for doing http tests with mocha
/**
* Modified version of TJ's http support file from the Express repo:
* https://github.com/visionmedia/express/blob/master/test/support/http.js
*
* Module dependencies.
*/
var EventEmitter = require('events').EventEmitter
, should = require('should')
, methods = ['get','post','put','delete','head']
var relativeDate = (function(undefined){
var SECOND = 1000,
MINUTE = 60 * SECOND,
HOUR = 60 * MINUTE,
DAY = 24 * HOUR,
WEEK = 7 * DAY,
YEAR = DAY * 365,
MONTH = YEAR / 12;
@bsstoner
bsstoner / gist:7530799
Last active December 28, 2015 16:39
local .vimrc.after
set nocompatible
set guioptions=aAce
set number
set ruler
syntax on
" Whitespace stuff
set nowrap
@bsstoner
bsstoner / couchdb-ec2-install.sh
Created June 8, 2012 20:28 — forked from msmith/couchdb-ec2-install.sh
Set up CouchDB on EC2
#!/bin/bash
#
# This script installs and configures couchdb on a fresh Amazon Linux AMI instance.
#
# Must be run with root privileges
# Tested with Amazon Linux AMI release 2011.02.1.1 (ami-8c1fece5)
#
export BUILD_DIR="$PWD"
{
creator: {
fbId: 12345,
name: "Brian Stoner"
},
friend_queue: [
'http://a6.sphotos.ak.fbcdn.net/hphotos-ak-snc4/46327_751529381931_32471_40134857_189347_n.jpg',
'http://a1.sphotos.ak.fbcdn.net/hphotos-ak-ash2/60009_758235258301_32471_40319103_1596769_n.jpg',
'http://a3.sphotos.ak.fbcdn.net/hphotos-ak-snc4/38320_741291478771_32471_39785387_5405113_n.jpg'
def search
bing = RBing.new('1F2DDCE3F2B8077381B1CD1A5FF9B34B37F3C173')
@rsp1 = bing.image(params[:thing1], :style => 'photo')
@rsp2 = bing.image(params[:thing2], :style => 'photo')
@thing1 = params[:thing1]
@thing2 = params[:thing2]
end
@bsstoner
bsstoner / Node.js OpenTokSDK
Created November 20, 2010 04:28
Node.js implementation of Tokbox's OpenTokSDK
/**
* Node.js implementation of Tokbox's OpenTokSDK
*
* by Brian Stoner
*
* var tokbox = require('./tokbox')
*
* var t = new tokbox.OpenTokSDK(API_KEY,API_SECRET)
*
* t.createSession('127.0.0.1', {}, function(session){
cd /path/to/files/
for fl in *.js; do
mv $fl $fl.old
sed -e 's/find_string/replace_string/' $fl.old > $fl
rm -f $fl.old
done
/**
* SocketManager - Singleton to manage multi-channel socket 'routing', need a way to merge with socket.io so client sessions aren't stored twice in memory,
*
* Requires Socket.IO-node and Socket.IO client libraries.
*
* Usage:
* in your main app.js file (or whereever you create the server)
*
* var io = require('socket.io'),
* sm = require('socketmanager');
###########################################################################
## Playing around with the awesome Echonest Remix API.
##
## http://code.google.com/p/echo-nest-remix/
##
## This is a script that will loop 4 beats from track 1 and mix them
## behind track 2., also syncing the track tempos
##
## Change the variables below.
###########################################################################