Skip to content

Instantly share code, notes, and snippets.

@FGRibreau
FGRibreau / pid.js
Created February 16, 2012 18:41
Simple snippet for cross-platform .pid management in NodeJS. I use it for managing NodeJS apps with supervisord and monit
//
// Usage: require('./pid')("myapp");
//
var fs = require('fs');
module.exports = function(appname){
process.title = appname;
var PID_FILE = "/usr/local/var/run/"+process.title+".pid";
@addyosmani
addyosmani / async.js
Created February 7, 2012 17:20
Cache a library using localStorage and Base64
// some modified async work based on prior by necolas
(function(d){
var js,
fjs = d.getElementsByTagName('script')[0],
frag = d.createDocumentFragment(),
add = function(url, id) {
if (d.getElementById(id)) {return;}
js = d.createElement('script');
js.src = url;
id && (js.id = id);
@azproduction
azproduction / LICENSE.txt
Created December 13, 2011 13:56 — forked from 140bytes/LICENSE.txt
Lazy (and synchronous) Module Declaration in 126 bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mikhail Davydov
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@guybrush
guybrush / nodeconf_2011.md
Created May 6, 2011 07:22
a list of slides from nodeconf 2011
@gbakernet
gbakernet / Node Smart Machine CouchDB
Created January 18, 2011 00:09
Node Smart Machine CouchDB
#Steps
pkgin install couchdb
svccfg import /opt/local/share/smf/manifest/couchdb.xml
svcadm enable couchdb
#Test
curl http://127.0.0.1:5984/
{"couchdb":"Welcome","version":"1.0.1"}
From 9241b751f9b42d970844fdc62fe84a01aa6d5203 Mon Sep 17 00:00:00 2001
From: Ryan Dahl <ry@tinyclouds.org>
Date: Wed, 6 Oct 2010 14:57:46 -0700
Subject: [PATCH] Raw string access
---
include/v8.h | 26 +++++++++
src/api.cc | 12 ++++
src/objects.cc | 65 ++++++++++++++++++++++
src/objects.h | 5 ++
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active May 16, 2024 16:51
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
/**
* Based on node-uuid.js http://gist.github.com/393456
*
* Generates a new UUID and passes it to the given callback function.
*
* Calls uuid.sh - make your own depending on your system. I followed an example here: http://www.redleopard.com/2010/03/bash-uuid-generator/
*
* Callback signature is function(err, uuid).
*/
exports.create_uuid = (function() {