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
#!/bin/sh | |
read -p 'Project name: ' project_name | |
cat > .gitignore <<EOF | |
npm-debug.log | |
node_modules | |
.DS_Store | |
.*.sw[op] | |
EOF |
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 util = require('util'), | |
Stream = require('stream'); | |
var FastJSONStream = exports.FastJSONStream = function (options) { | |
this.bufferSize = options.bufferSize; | |
this._buffer = new Buffer(this.bufferSize); | |
}; | |
util.inherits(FastJSONStream, Stream); | |
FastJSONStream.prototype.write = function (chunk) { |
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 nssocket = require('../lib/nssocket'); | |
// | |
// define a simple message protocol as [<type>, <id>] and create some messages that use it. | |
// | |
var message1 = ['message', 'one']; | |
var message2 = ['message', 'two']; | |
// | |
// Create an `nssocket` TCP server and tell the server to listen on port `6785`. |
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
PID/THRD RELATIVE ELAPSD SYSCALL(args) = return | |
25607/0x4c060d: 258 19 __sysctl(0x10B580940, 0x6, 0x0) = 0 0 | |
25607/0x4c060d: 265 7 __sysctl(0x10B580940, 0x6, 0x7FDB61802000) = 0 0 | |
25607/0x4c060d: 275 2 gettimeofday(0x10B5809A0, 0x0, 0x10B580964) = 1329155773 0 | |
25607/0x4c060d: 276 1 gettimeofday(0x10B580B58, 0x0, 0xD4AD9) = 1329155773 0 | |
25607/0x4c060d: 279 4 kqueue(0x10B580B58, 0x0, 0xD4AE3) = 3 0 | |
25607/0x4c060d: 281 3 kevent(0x3, 0x10B580B38, 0x1) = 0 0 | |
25607/0x4c060d: 290 5 socket(0x1, 0x1, 0x0) = 4 0 | |
25607/0x4c060d: 293 4 setsockopt(0x4, 0xFFFF, 0x1022) = 0 0 |
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 forever = require('forever'); | |
var m = new forever.Monitor(); | |
m.command = '/usr/bin/env'; | |
m.args = ['node', '--trace-gc', 'gc.js']; | |
m.start(); |
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
#!/usr/bin/env ruby | |
if ARGV[0] and ARGV[1] | |
slug = ARGV[0] + "/" + ARGV[1] | |
else | |
url = `git config --get remote.origin.url` | |
return $?.exitstatus if $?.exitstatus != 0 | |
m = /git@github\.com:([a-zA-Z0-9_-]+)\/([a-zA-Z0-9._-]+)\.git/.match(url) | |
slug = m[1] + "/" + m[2] | |
end | |
$stdout.write "[![Build Status](https://secure.travis-ci.org/#{slug}.png)](http://travis-ci.org/#{slug})" |
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
#!/usr/bin/node | |
require('child_process').spawn(process.argv[2], process.argv.slice(3), { customFds: [0, 1, 2] }); |
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 util = require('util'), | |
Plates = require('plates'), | |
flatiron = require('../'), | |
app = flatiron.app; | |
app.use(flatiron.plugins.http); | |
var sandwiches = { | |
bacon: 24, | |
burger: 42 |
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 registry = require('./registry'); | |
console.log('Analyzing ' + registry.total_rows + ' rows'); | |
var haveGithub = 0; | |
registry.rows.forEach(function (row) { | |
var doc = row.doc; | |
if (!doc['dist-tags'] || !doc['dist-tags'].latest) { | |
return console.error(doc.name + ' has no dist-tags'); |
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 fs = require('fs'), | |
cradle = require('./'), | |
db = new(cradle.Connection)().database('cradle'); | |
db.save('hello', function (err, doc) { | |
db.saveAttachment('hello', 'world', 'text/plain', fs.createReadStream('someFile')); | |
}); |