Skip to content

Instantly share code, notes, and snippets.

View timhudson's full-sized avatar

Tim Hudson timhudson

View GitHub Profile
var fs = require('fs')
var benchmark = require('benchmark')
var suite = new benchmark.Suite()
var xmlNodes = require('../index.js') // xml-nodes/buffers
var xmlNodesStr = require('../index-str.js') // xml-nodes/master
// start benchmarking
suite
.add('buffers', {
'defer' : true,
@timhudson
timhudson / app.js
Created June 14, 2014 03:09
React write stream thoughts
var ObserveStream = require('observ-stream')
var ReactWriteStream = require('react-write-stream')
var state = require('./state')
var Row = require('./row')
ObserveStream(state)
.pipe(ReactWriteStream(Row, document.getElementById('example'))
setInterval(function() {
state.age.set(state.age()++)
dataStream.pipe(reactStream).pipe(dataStream)
var _ = require('highland'),
redis = require('redis'),
client = redis.createClient();
var pattern = process.argv[2],
count = process.argv[3] || 10
client.on('error', function(err) {
throw err
});
{
"Statement": [
{
"Effect": "Allow",
"Action": "S3:*",
"Resource": "arn:aws:s3:::foo/*",
"Condition": {}
},
{
"Effect": "Allow",
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
var resourceModels = {}
function getModel(app) {
if (resourceModels[app]) return resourceModels[app]
return resourceModels[app] = mongoose.model('resource'+app, schema)
}
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
#!/bin/sh
# From - http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
#
# redis - this script starts and stops the redis-server daemon
# Originally from - https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.github.com/timhudson/6787518/raw/e11cd22f41e6cab71fe621b1f5a1377ff3af01ab/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################