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

Keybase proof

I hereby claim:

  • I am nvcexploder on github.
  • I am benacker (https://keybase.io/benacker) on keybase.
  • I have a public key ASBfdz0pXE7jpW_iXuJxTg35h1Y41RxAm0R-Vp58HNeP-Qo

To claim this, I am signing this object:

@nvcexploder
nvcexploder / master.vim
Created February 23, 2017 14:18 — forked from benjamincharity/master.vim
Master Vim with this interactive tutorial.
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@nvcexploder
nvcexploder / no.md
Created April 6, 2016 18:14
For CJ.

OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

@nvcexploder
nvcexploder / hapiExample.js
Last active July 25, 2021 05:39
basic hapi.js example highlighting HTTP methods and a few request parameters
/*
For this to run, ensure that `npm install hapi` has happened in your directory
setup whilst writing this:
iojs v. 1.0.5
hapi 8.2.0
*/
var Hapi = require('hapi');
@nvcexploder
nvcexploder / server.js
Created October 21, 2014 00:59
Creating a TLS server in hapi.js
var Hapi = require('hapi');
var Fs = require('fs');
var options = {
tls: {
key: Fs.readFileSync(your_key),
cert: Fs.readFileSync(your_cert)
}
};
@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 file=@lulz.png localhost:8080/selfies
@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();

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 / 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')
@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();