Skip to content

Instantly share code, notes, and snippets.

exports.create = function() {
var queue = [],
queueIndex = 0;
// I don't know if we want to save state, but it is easy to implement.
// I am just worried about overhead
var cachedValue = null;
var enqueue = function enqueue(func) {
queue.push(func);
var posix = require("posix");
var sys = require("sys");
var continuables = require('continuables');
function writeFile(filename, value, mode) {
if (typeof value !== "string") {
throw new Error('Value must be a string');
}
if (typeof mode === "undefined") {
mode = 0600;
From 13ca65a21232b1f14b4b2213803f48884b00bb96 Mon Sep 17 00:00:00 2001
From: Benjamin Thomas <benjamin@benjaminthomas.org>
Date: Mon, 22 Feb 2010 06:47:15 +0000
Subject: [PATCH] Fix bug in process.mixin where deep copies would not work at all.
Before, doing this:
var sys = require("sys");
var obj = {
From c40555b5b2a0269b05ea17753c63567fd890dc26 Mon Sep 17 00:00:00 2001
From: Benjamin Thomas <benjamin@benjaminthomas.org>
Date: Thu, 25 Feb 2010 20:38:04 +0000
Subject: [PATCH] Add a 'resolve' method to require that returns the path to the module.
---
doc/api.txt | 16 ++++++++++++++++
src/node.js | 29 ++++++++++++++++++++++-------
test/simple/test-require-resolve.js | 15 +++++++++++++++
3 files changed, 53 insertions(+), 7 deletions(-)
From b3453495dec74897a36941c2b94f70861dd1deae Mon Sep 17 00:00:00 2001
From: Benjamin Thomas <benjamin@benjaminthomas.org>
Date: Sat, 27 Feb 2010 08:32:55 +0000
Subject: [PATCH] Stop sys.inspect from adding extra new lines for deep objects that are elements in an array.
A couple other small fixes:
If the keys of an object were all numeric they should be quoted. This
way, you can now hypothetically copy and paste the output into your code
(if the object doesn't contain any circular objects, deeply nested
require "rubygems"
require "RMagick"
require "rvg/rvg"
rvg = Magick::RVG.new(150, 100) do |canvas|
canvas.background_fill = 'white'
txt = canvas.text(140, 20).styles(
:font_size => 28,
:text_anchor => "end"
)
From c02c28574aa9ac7ec0b2751b94240e23860b85a4 Mon Sep 17 00:00:00 2001
From: Benjamin Thomas <benjamin@benjaminthomas.org>
Date: Tue, 22 Jun 2010 15:27:10 -0600
Subject: [PATCH] Start work on properly sandboxing modules
---
lib/connect/index.js | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/connect/index.js b/lib/connect/index.js
def render_footnotes()
div = Element.new 'div'
div.attributes['class'] = 'footnotes'
div << Element.new('hr')
ol = Element.new 'ol'
@doc.footnotes_order.each_with_index do |fid, i| num = i+1
f = self.footnotes[fid]
if f
li = f.wrap_as_element('li')
From 401d78805122b8edbb56b1d3d54e7e81148cb94a Mon Sep 17 00:00:00 2001
From: Benjamin Thomas <benjamin@benjaminthomas.org>
Date: Fri, 27 Aug 2010 02:50:12 -0600
Subject: [PATCH] Fix process.nextTick so thrown errors don't confuse it.
If the function for a process.nextTick throws an error, then the
splice() never removes that function from the nextTickQueue array. This
makes sure the functions that have been run in _tickCallback get removed
regardless of errors.
// this has been tested with HEAD node
// (http://github.com/ry/node/commit/57642e23497d5698aa4c5b8a44edff7b265c2283)
process.on('exit', function() {
console.log('hey');
});