Skip to content

Instantly share code, notes, and snippets.

View dscape's full-sized avatar

Nuno Job dscape

View GitHub Profile
@BenHall
BenHall / Installing_0_11_On_Ubuntu
Created April 3, 2010 19:50
Upgrading Couchdb 0.10 to 0.11
sudo aptitude install automake spidermonkey-bin autoconf subversion-tools libtool help2man build-essential erlang erlang-manpages libicu38 libmozjs-dev wget libicu-dev libreadline5-dev checkinstall
sudo apt-get install libcurl4-openssl-dev
wget http://mirrors.enquira.co.uk/apache/couchdb/0.11.0/apache-couchdb-0.11.0.tar.gz
tar -xzvf apache-couchdb-0.11.0.tar.gz
cd apache-couchdb-0.11.0
./configure --bindir=/usr/bin --sbindir=/usr/sbin --localstatedir=/var --sysconfdir=/etc
make
@cpinto
cpinto / mustache_xpath_partials.js
Created October 4, 2010 18:21
Read the top comments
/*
* Q: What is this?
* A: A sample file that uses mustache to render a single html tmeplate (including partials) on the serverside but keeps those partials intact so that they can be used by the client-side as well (ie. browser)
*
* Q: How is this useful?
* A: To you, I have little idea. I'm doing this because I want to be able to fully render a page on the server and then refresh parts of it on the client, while reusing the widget presentation code. As the widget code is in the file, I just have to bring in mustache.js, fetch new data, and have it render the parts I need to update. And I'd like to keep it all in a single file also.
*
* Q: Isn't that template code broken?
* A: Yes. I'll come back to it as I plan to patch Mu to support xpath partials natively.
* */
var start = Date.now()
http = require("http")
console.error("%d scheduling nextTick", Date.now() - start)
process.nextTick(function interval(){
process.nextTick(interval)
process.stderr.write(".")
var STATUS =
{ VALUE: 0 // now comes an object, array, string, or whatever else you can imagine
, ARRAY: 1
, STRING: 2
, NUMBER: 3
, TRUE: 4
, FALSE: 5
, NULL: 6
, OBJECT: 7
}
@creationix
creationix / output.log
Created December 21, 2011 15:38
sample usage for jsonparse.
'bar'
{ foo: 'bar' }
'Hello'
'World'
[ 'Hello', 'World' ]
1
2
3
[ 1, 2, 3 ]
[ [ 'Hello', 'World' ], [ 1, 2, 3 ] ]
@indexzero
indexzero / README.md
Created January 14, 2012 04:38
npmcount output for groups of node.js thought leaders
@max-mapper
max-mapper / index.js
Created February 5, 2012 22:29
node bufferedstream proxy
var request = require('request');
var BufferedStream = require('morestreams').BufferedStream;
function requestHandler(req, res) {
// immediately pipe the incoming request into a paused bufferedstream.
// if you try to pipe after a nextTick it won't work because data starts
// arriving immediately
var bufferedStream = new BufferedStream
bufferedStream.pause()
req.pipe(bufferedStream)
@mmalecki
mmalecki / fast-json-stream.js
Created February 14, 2012 15:03
Sort of.
var util = require('util'),
Stream = require('stream');
var FastJSONStream = exports.FastJSONStream = function (options) {
this.bufferSize = options.bufferSize;
this._buffer = new Buffer(this.bufferSize);
};
util.inherits(FastJSONStream, Stream);
FastJSONStream.prototype.write = function (chunk) {
@PatrickHeneise
PatrickHeneise / gist:2132062
Created March 20, 2012 06:38
passport.js with flatiron.js, union and director
var flatiron = require('flatiron')
, connect = require('connect')
, path = require('path')
, fs = require('fs')
, plates = require('plates')
, director = require('director')
, util = require('util')
, keys = require('./auth_keys')
, passport = require('passport')
, TwitterStrategy = require('passport-twitter').Strategy
@indexzero
indexzero / git-commit-prefixes
Created April 20, 2011 22:09
Short list of Git commit prefixes used at Nodejitsu
[api]: New apis / changes to apis
[test]: Update test/* files
[dist]: Changes to submodules, version bumps, updates to package.json
[minor]: Small changes
[doc]: Updates to documentation
[ux]: Updates to UX
[fix]: Bug fixes
[bin]: Update binary scripts associated with the project
[merge]: Resolved git merge from upstream or otherwise
[refactor]: Refactor of existing code with no external API changes