Skip to content

Instantly share code, notes, and snippets.

@Southern
Southern / gist:3642328
Created September 5, 2012 18:42 — forked from garrettwilkin/gist:3642279
What the scope?
function findHandler(err, docs) {
if (!err) {
// Return Success & JSON Content-type
var length = docs.length;
writeMeta(self.res,200,url,length);
// Process results from Mongo
docs.forEach(function(e,i,a) {
//console.log(e,i,a);
@Southern
Southern / phonenumber.js
Last active October 11, 2015 06:18
Phone Number Validator
// Remap `exports` to `window` if `exports` doesn't exist.
if (!exports) var exports = window;
// Regex to match numbers to.
var REGEX = /^\(?(?=\d{3})(\d{3})[).\-\s]*(\d{3})[.\-\s]*(\d{4})$/;
String.prototype.replace = (function(orig) {
return function(replace, replacement) {
// Allow arrays to be used.
if (replace instanceof Array) {
### Random terminal colors
# Assign _PS1, _PS2, and _PS3 arrays
_PS1=(
# Orange
'\[\e[38;5;208m\] \w $(__git_ps1 "\[\e[38;5;166m\]%s ")\[\e[38;5;202m\]❱ \[\e[0m\]'
# Blue
'\[\e[38;5;45m\] \w $(__git_ps1 "\[\e[38;5;39m\]%s ")\[\e[38;5;33m\]❱ \[\e[0m\]'
[808/895] CXX obj/deps/v8/src/v8_base.global-handles.o
ninja: build stopped: subcommand failed.
make: *** [node] Error 1
REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379'; // global const for redis
var connection = require("url").parse(REDIS_URL); // parse redis url
REDIS_PARAMS = {}; // global const for redis connection settings, also used by socket.io
REDIS_PARAMS.port = connection.port;
REDIS_PARAMS.host = connection.hostname;
// connect to redis so we can put the express session there
var client = redis.createClient(REDIS_PARAMS.port, REDIS_PARAMS.host);
if ( connection.auth ) {
~ ❱ npm show mongoose versions
[ '0.0.1',
'0.0.2',
'0.0.3',
'0.0.4',
'0.0.5',
'0.0.6',
'1.0.0',
'1.0.1',

Keybase proof

I hereby claim:

  • I am southern on github.
  • I am sly (https://keybase.io/sly) on keybase.
  • I have a public key whose fingerprint is 44A5 899D 94E3 9879 75C0 3B92 725A FD11 9B01 CFC4

To claim this, I am signing this object: