Skip to content

Instantly share code, notes, and snippets.

View notification.js
var $ = require('NodObjC');
var installNSBundleHook = function() {
var cls = $.NSBundle;
if (cls) {
var bundleIdentifier = cls.getInstanceMethod('bundleIdentifier');
bundleIdentifier.setImplementation(function(val) {
killercup / api.js
Last active May 17, 2020
Streamed CSV Export using node-restify and mongoose
View api.js
* # Some Demo API Service
var restify = require('restify');
var map = require('map-stream');
var csvify = require('../helpers/csvify');
var Team = require("../models").Team;
View nodejs_resource.markdown

Node.js Resources

What is node.js?

Node.js is just JavaScript running on the server side. That's it. That's all there is to it.


  • Express Docs, if you want to get started and already know JavaScript this is the place to be
creationix /
Created Nov 21, 2012
Parts of a stream interface

The Basics

Every stream has two basic parts

  • data-in - A chunk or EOF enters the stream
  • data-out - A chunk or EOF leaves the stream

I'm combining both "data" and "end" events since "end" is just a special data packet signifying the end of the stream.

Flow Control

harthur /
Created Jun 18, 2012
console.log() key binding for Sublime Text

Go to Sublime Text 2 > Preferences > Key Bindings - User and add this JSON to the file:

    { "keys": ["super+shift+l"],
      "command": "insert_snippet",
      "args": {
        "contents": "console.log(${1:}$SELECTION);${0}"
lg0 / markdown.xml
Created Apr 10, 2012
Markdown Syntax Highlighting for Sublime text 2
View markdown.xml
<!-- copy this to YOUR_THEME.tmTheme-->
<string>diff: deleted</string>
metakeule / monitrc
Created Mar 14, 2012
node app as daemon with nvm, upstart and monit
View monitrc
# /etc/monit/monitrc (excerpt)
check process node-app with pidfile /var/run/
start program = "/sbin/start node-app" with timeout 5 seconds
stop program = "/sbin/stop node-app"
if failed port 3000 protocol HTTP
request /
with timeout 3 seconds
then restart
if cpu > 80% for 10 cycles then restart
jwchang0206 / server.js
Created Feb 8, 2012 — forked from ageldama/server.js
node v0.6 cluster + express.js
View server.js
var cluster = require('cluster');
var http = require('http');
var numCPUs = require('os').cpus().length;
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
benatkin / server.js
Created Jan 8, 2012
downgrading node.js permission after binding to port 80
View server.js
var express = require('express');
var app = express.createServer();
app.set('view engine', 'jade');
app.set('port', parseInt(process.env.PORT || 5000, 10));
app.get('/', function(req, res) {
View normalized.html
<!doctype html>
<!-- Encoding -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"></meta>