Skip to content

Instantly share code, notes, and snippets.

View mikegerwitz's full-sized avatar

Mike Gerwitz mikegerwitz

View GitHub Profile
var fs = require( 'fs' ),
// size in bytes
CHUNK_SIZE = 50,
file = fs.open( 'file', 'r', '0666', function( err, fd )
{
if ( err )
{
console.log( err );
function foo( i )
{
if ( i === 0 )
{
return;
}
foo( i - 1 );
}
@mikegerwitz
mikegerwitz / ref.js
Created March 22, 2011 05:23
By reference vs by value
var a = {},
b = {};
// primitives are passed by value
a.num = 1;
b.num = a.num;
b.num = 5;
a.num; // still equals 1
b.num; // equals 5