Skip to content

Instantly share code, notes, and snippets.

@listochkin
listochkin / README.md
Last active March 11, 2017 06:41
How Node Resolves Dependencies

How Node Resolves Dependencies

Read more about node_modules and how you can use them in official node/iojs docs:

If the module identifier passed to require() is not a native module, and does not begin with '/', '../', or './', then io.js starts at the parent directory of the current module, and adds /node_modules, and attempts to load the module from that location.

If it is not found there, then it moves to the parent directory, and so on, until the root of the file system is reached.

Here I show you how you can easily build a hierarchy of modules inside your project and use nested node_modules directories to manage dependencies within your application. This is a pretty good solution that doesn't require you to change NODE_PATH, use many git repositories or setting up a private registry.

@listochkin
listochkin / node-command-line-options.txt
Created April 17, 2014 11:00
Node V8 GC-related options
--log_gc (Log heap samples on garbage collection for the hp2ps tool.)
type: bool default: false
--expose_gc (expose gc extension)
type: bool default: false
--max_new_space_size (max size of the new generation (in kBytes))
type: int default: 0
--max_old_space_size (max size of the old generation (in Mbytes))
type: int default: 0
--max_executable_size (max size of executable memory (in Mbytes))
type: int default: 0
@listochkin
listochkin / gist:1200393
Created September 7, 2011 12:02
Algorithm for Area of a closed polygon.

Re: Algorithm for Area of a closed polygon.

To: Ted Hill <thill@tomotherapy.com>
Subject: Re: Algorithm for Area of a closed polygon.
From: "Demian M. Nave" <dnave@psc.edu>
Date: Wed, 12 Nov 2003 21:23:16 -0500 (EST)
Cc: <compgeom-discuss@research.bell-labs.com>
In-reply-to: <1E2E66102E75104D8C740340EBCD98671BC279@tomoex.tomotherapy.com>

References: <1E2E66102E75104D8C740340EBCD98671BC279@tomoex.tomotherapy.com>