Skip to content

Instantly share code, notes, and snippets.

View indexzero's full-sized avatar
🌎
Always bet on Open Source

Charlie Robbins indexzero

🌎
Always bet on Open Source
View GitHub Profile
var fs = require('fs'),
cradle = require('cradle'),
db = new(cradle.Connection).database('YOUR_DATABASE');
fs.readFile('/your/huge/file', function (err, data) {
if (err) throw err;
var parsed = JSON.parse(data.toString());
db.insert('your doc', parsed);
});
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario: Add two numbers
Given I have entered 50 into the calculator
And I have entered 70 into the calculator
When I press add
Then the result should be 120 on the screen
Feature: {{name}}
{{featureDescription}}
Scenario: {{name}}
{{operator}} {{description}}
# Or Conversely, for any Scenario with parameters:
Scenario Outline: {{name}}
{{operator}} {{description}}
response.addListener('end', function () {sys.puts('ENDING')});
var _e = res.end;
res.end = function () { sys.puts("called end"); _e();};
sys.pump(response, res);
1
2
3
4
yum update
rpm -ivh http://repo.webtatic.com/yum/centos/5/`uname -i`/webtatic-release-5-1.noarch.rpm
yum install --enablerepo=webtatic git-all
yum install openssl-devel pkgconfig gcc gcc-c++ kernel-devel make
cd /usr/src
git clone http://github.com/ry/node.git
cd node
./configure
make
make install
var a = {
x: 1
};
var props = {
x: { value: 1 }
};
var b = Object.create(a);
var c = Object.create(a,b);
@indexzero
indexzero / arena
Created October 7, 2010 05:22 — forked from chapel/arena
var httpAgent = require('http-agent'),
url = require('url'),
sys = require('sys');
exports.start = function () {
var agent = httpAgent.create('www.bungie.net', ['/stats/reach/playergamehistory.aspx?player=thechapel&vc=2']);
agent.addListener('next', function (err, agent) {
var uri = url.parse(agent.current.uri);
exports.dispatch(uri);
var b = new Buffer(256*256)
for (var i = 0 ; i < 256*256 ; i ++) {
b[i] = i % 256
}
var s = b.toString("binary")
var b2 = new Buffer(s, "binary")
for (var i = 0 ; i < 256*256 ; i ++) {
if (b2[i] !== i) console.error("error at 0x"+i.toString(16))
}
@indexzero
indexzero / output
Created October 28, 2010 19:16
vows-journey-web-service.js
$ vows sample.js --spec
The 'sys' module is now called 'util'. It should have a similar interface.
♢ some/sample/test
When using my test server any http request
✓ should respond with hello world
When the tests are complete
✓ stop the test server