Skip to content

Instantly share code, notes, and snippets.

View nvcexploder's full-sized avatar

Ben Acker nvcexploder

  • Joyent/Samsung
  • The Woods, North Carolina
View GitHub Profile
@nvcexploder
nvcexploder / gist:2354305
Created April 10, 2012 20:39
nodejitsu error on deplyment
{
"process": {
"pid": 8461,
"uid": 459565676,
"gid": 74715970,
"cwd": "/Users/backer/src/git/ren",
"execPath": "/usr/local/bin/node",
"version": "v0.6.7",
"argv": [
"node",
@nvcexploder
nvcexploder / derp.js
Created August 17, 2012 00:52
Taxonomy XML
var Xml = require('./lib/xml');
var Fs = require('fs');
var config = {
// enforceSingle:['name',
// 'url',
// 'level',
// 'id',
// 'parent',
// 'rank',
@nvcexploder
nvcexploder / server.js
Created September 6, 2012 16:55
hapi 0.6.0 server file
/*
* Copyright (c) 2012 Walmart. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
var Fs = require('fs');
var Http = require('http');
var Https = require('https');
@nvcexploder
nvcexploder / showingVan
Created September 19, 2012 23:18
Recursive Call
internals.searchChildren = function ( id, toSearch, callback ) {
for( child in toSearch ) {
console.log('FOR LOOP');
if( id == toSearch[child].id ) {
//return the child
callback(null, toSearch[child].children);
@nvcexploder
nvcexploder / REPL.js
Created May 10, 2013 02:48
REPL for Node coptor API
var arDrone = require('ar-drone');
var client = arDrone.createClient();
client.createRepl();
@nvcexploder
nvcexploder / hapi addresses
Created January 6, 2014 22:23
Address in Use Problem
var hapi = require('hapi');
var server = hapi.createServer('localhost', 8080);
var server2 = hapi.createServer('localhost', 8080);
server.start();
server2.start();
@nvcexploder
nvcexploder / route.js
Created February 11, 2014 00:47
Route validation config showing nested Joi configuration objects
exports.create = {
description: 'Creates a new cart',
validate: {
payload: {
location: Joi.object({
postalCode: Joi.string().required().description('Postal Code'),
city: Joi.string().optional().description('City'),
state: Joi.string().optional().description('State or Province Code'),
country: Joi.string().optional().description('Country')

Keybase proof

I hereby claim:

  • I am nvcexploder on github.
  • I am benacker (https://keybase.io/benacker) on keybase.
  • I have a public key whose fingerprint is B6D0 5541 82DA F2B9 E37C 9B25 0DEF AEF7 7925 4224

To claim this, I am signing this object:

@nvcexploder
nvcexploder / onreq.js
Created August 7, 2014 01:33
Change URL in a hapi onRequest ext point.
// wherever you're setting up your server, this was within a register method for a plugin:
plugin.select('api').ext('onRequest', internals.onRequest);
//somewhere else in that file or whatever
var onRequest = function (request, next) {
request.setUrl(exports.rewriteUrl(request.raw.req.url));
next();
@nvcexploder
nvcexploder / command line stuff
Last active October 19, 2016 14:21
Streaming payloads with Hapi
$ npm install hapi joi
#A good way to test is this:
$ curl --form [email protected] localhost:8080/selfies