(Ends)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this needs to be read from the DB on startup | |
var userId = 1; | |
function putUser(user, cb) { | |
// am making this up for the purposes of demonstration - don't know what your use-case is | |
userId++; | |
user.id = userId; | |
var ops = [ | |
{ type: 'put', key: 'sequence:userId', value : userId }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
var pg = require('pg'); | |
var connString = "postgres://postgres@localhost/template1"; | |
// attempt 1 - all ok | |
pg.connect(connString, function(err, client, done) { | |
// this function has a .length of 3 ... therefore done is defined | |
console.log('1) Connected ok'); | |
done(); | |
// pg.end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
models = require './' | |
sql = require 'sql' | |
crypto = require 'crypto' | |
Downstairs = require('downstairs').Downstairs | |
Table = require('downstairs').Table | |
env = require './../config/env' | |
uuid = require 'node-uuid' | |
logging = require './../lib/logging' | |
moment = require 'moment' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm test | |
> [email protected] test /home/chilts/src/appsattic-sound | |
> tap test/*.js | |
not ok test/basic.js .................................... 6/9 | |
Command: "node" "basic.js" | |
TAP version 13 | |
ok 1 is an object | |
ok 2 string passes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grunt.registerMultiTask('s3deploy', 'deploy to S3 using awssum', function () { | |
// dependencies | |
var awssum = require('awssum'), | |
fs = require('fs'), | |
path = require('path'), | |
aws = require('./settings').aws; | |
var amz = awssum.load('amazon/amazon'), | |
AmazonS3 = awssum.load('amazon/s3'), | |
s3 = new AmazonS3({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fmt = require('fmt'); | |
var pg = require('pg'); | |
var conString = "pg://scroober@localhost/scroober"; | |
pg.connect(conString, function(err, cl) { | |
if (err) { | |
console.log(err); | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello World\n'); | |
}).listen(1337, '127.0.0.1', function() { | |
console.log('listening'); | |
}); | |
console.log('Server running at http://127.0.0.1:1337/'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./test.js -b my-bucket | |
Bucket=my-bucket | |
Concurrency=3 | |
Bucket=my-bucket | |
Concurrency=undefined |