This file contains hidden or 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('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); | |
}); |
This file contains hidden or 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
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 |
This file contains hidden or 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
Feature: {{name}} | |
{{featureDescription}} | |
Scenario: {{name}} | |
{{operator}} {{description}} | |
# Or Conversely, for any Scenario with parameters: | |
Scenario Outline: {{name}} | |
{{operator}} {{description}} |
This file contains hidden or 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
response.addListener('end', function () {sys.puts('ENDING')}); | |
var _e = res.end; | |
res.end = function () { sys.puts("called end"); _e();}; | |
sys.pump(response, res); |
This file contains hidden or 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
1 | |
2 | |
3 | |
4 |
This file contains hidden or 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
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 |
This file contains hidden or 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 a = { | |
x: 1 | |
}; | |
var props = { | |
x: { value: 1 } | |
}; | |
var b = Object.create(a); | |
var c = Object.create(a,b); |
This file contains hidden or 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 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); |
This file contains hidden or 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 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)) | |
} |
This file contains hidden or 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
$ 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 | |