Used to determine if a process pid is running from node.js.
expect(1234).to.be.alive;| function printStackTrace() { | |
| var callstack = []; | |
| var isCallstackPopulated = false; | |
| try { | |
| i.dont.exist+=0; //doesn't exist- that's the point | |
| } catch(e) { | |
| if (e.stack) { //Firefox | |
| var lines = e.stack.split('\n'); | |
| for (var i=0, len=lines.length; i<len; i++) { | |
| if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) { |
| #!/bin/sh | |
| ## Node.js for Raspberry Pi Packaging Script | |
| ## ========================================= | |
| ## Execute this script from within node.js git repo | |
| ## Use like this: | |
| ## ~/node/$ VERSION=v0.10.0 ./buildnode.sh | |
| if [ -z $VERSION ]; then | |
| echo "set the VERSION first" | |
| exit 1 |
| // add to top or helpers file for tests | |
| chai.Assertion.addProperty('function', function () { | |
| this.to.be.a('function'); | |
| }); | |
| // then... | |
| function fn () {}; | |
| fn.should.be.a.function; |
| #!/usr/bin/env node | |
| /* | |
| * This module can verify that packages installed during development are | |
| * identical to those installed during deployment. The standard npm shrinkwrap | |
| * only ensures that package versions are the same, but does not verify contents. | |
| * This module checks the shasum of the package tarballs downloaded by npm during | |
| * development and deployment to ensure they are the same. | |
| * | |
| * Usage: |
| module.exports = function (socketio) { | |
| socketio.Socket.prototype.stack = function () { | |
| var ev = arguments[0] | |
| , cbs = Array.prototype.slice.call(arguments, 1); | |
| this.on(ev, function () { | |
| var args = Array.prototype.slice.call(arguments, 0) | |
| , cbl = cbs.slice() | |
| , fn = ('function' === typeof args[args.length - 1]) | |
| ? args[args.length - 1] |
Installation commands:
wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz
tar xvfz redis-2.4.8.tar.gz
cd redis-2.4.8/
mkdir -p /opt/redis
make PREFIX=/opt/redis install
cp redis.conf /opt/redis/redis.conf
useradd -rMU -d /opt/redis -s /bin/false -c redis redis| function toString (obj) { | |
| function _toString (i) { | |
| if (obj[i] === null) return 'null' | |
| if (typeof obj[i] === 'undefined') return 'undefined' | |
| if (obj[i].toString) return obj[i].toString() | |
| else return '' | |
| } | |
| return _toString | |
| } |
| # NAT interface routing | |
| *nat | |
| # Setup | |
| :PREROUTING ACCEPT [0:0] | |
| :INPUT ACCEPT [2:128] | |
| :OUTPUT ACCEPT [2:120] | |
| :POSTROUTING ACCEPT [2:120] | |
| # Redirect port 80 to port 8080 |
| var env = process.env.NODE_ENV || 'development'; | |
| var config = { | |
| development: {} | |
| , test: {} | |
| , staging: {} |