Skip to content

Instantly share code, notes, and snippets.

Ryan Dahl ry

Block or report user

Report or block ry

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ngx_queue.h
/*
* Copyright (C) Igor Sysoev
*/
#include <stddef.h> /* offsetof() */
#ifndef _NGX_QUEUE_H_INCLUDED_
#define _NGX_QUEUE_H_INCLUDED_
We couldn’t find that file to show.
View gist:222164
/* Copyright (c) 2009 Ryan Dahl <ry@tinyclouds.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
View gist:249750
db.query('SELECT 1')
('result1', function(result1) {
return db.query('SELECT 2');
})
('result2', function(result2) {
return db.query('SELECT 3');
})
('result3')
.addCallback(function(results) {
p(results); // == {result1: result1, result2: result2, result3: result}
View gist:250158
cloth 0 ~/projects/node > git diff --stat $(git rev-list -1 --until="5 hours ago" HEAD) -- **/*.js
lib/dns.js | 48 +++++-
lib/sys.js | 8 +-
src/node.js | 331 ++++++++++++++++++++++++++++++-------
test/mjsunit/disabled/test-dns.js | 29 ++++
4 files changed, 350 insertions(+), 66 deletions(-)
cloth 0 ~/projects/node > git diff --stat $(git rev-list -1 --until="5 hours ago" HEAD) -- **/*.{cc,h}
src/node.cc | 1 -
src/node_dns.cc | 94 ++++++++++----
src/node_events.cc | 138 --------------------
View gist:250922
diff --git a/src/node.js b/src/node.js
index c8f55c6..c0cd5db 100644
--- a/src/node.js
+++ b/src/node.js
@@ -536,6 +536,7 @@ var posixModule = createInternalModule("posix", function (exports) {
exports.read = function (fd, length, position, encoding) {
var promise = new process.Promise()
+ encoding = encoding | "binary";
process.fs.read(fd, length, position, encoding, callback(promise));
View net.js
var debugLevel = 0;
if ('NODE_DEBUG' in process.ENV) debugLevel = 1;
function debug (x) {
if (debugLevel > 0) {
process.stdio.writeError(x + '\n');
}
}
var assert = process.assert;
View reap_children.gitdiff
diff --git a/src/node.js b/src/node.js
index 69416d0..4ba4432 100644
--- a/src/node.js
+++ b/src/node.js
@@ -71,6 +71,8 @@ node.inherits = function () {
};
+var childProcesses = [];
+
View gist:271086
bpt-dmz 0 ~/node/stdin_issue > cat sub.js
var sys = require("../lib/sys");
process.stdio.open();
process.stdio.addListener("data", function (data) {
sys.puts("child: " + data);
});
bpt-dmz 0 ~/node/stdin_issue > cat test.js
var sys = require("../lib/sys");
var path = require('path');
var sub = path.join(path.dirname(__filename), 'sub.js');
View fab-promise.js
function loadConfig() {
return posix
.cat('config.json')
(true, function(config) {
return (config instanceof Error)
? posix.cat('configuration.json')
: config;
})
(function() {
return JSON.parse(config);
You can’t perform that action at this time.