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

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 / 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 / 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 / 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 / no.md
Created April 6, 2016 18:14
For CJ.

OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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i');
var server = hapi.createServer('localhost', 8080);
var server2 = hapi.createServer('localhost', 8080);
server.start();
server2.start();
@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 / 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);