Skip to content

Instantly share code, notes, and snippets.

View deedubs's full-sized avatar
:shipit:
kustomize build all-the-things | kubectl apply -f -

Dan Williams deedubs

:shipit:
kustomize build all-the-things | kubectl apply -f -
View GitHub Profile
@deedubs
deedubs / reset-db.js
Created October 30, 2013 15:03
Kill db after test run using mocha and mongoose
after(function (done) {
mongoose.connection.db.dropDatabase(function () {
mongoose.connection.close(done);
});
});
@deedubs
deedubs / query.js
Last active December 31, 2015 16:49
Example of populate query
Story
.find(...)
.populate({
path: 'fans',
match: { age: { $gte: 21 }},
select: 'name -_id',
options: { limit: 5 }
})
.exec()
@deedubs
deedubs / stats.js
Created April 30, 2014 15:06
Send response times to influxdb
var InfluxDB = require('influx');
module.exports.register = function (plugin, options, ready) {
var influx = new InfluxDB(options.host, options.port, options.username, options.password, options.database);
plugin.expose('client', influx);
plugin.ext('onRequest', function (req, next) {
throw new Error(msgs.join(' ') || 'Unknown error');
^
Error: Missing plugin name
at Object.exports.assert (/Users/deedubs/Projects/Igniter/example/node_modules/hapi/node_modules/hoek/lib/index.js:421:11)
at internals.Pack._register (/Users/deedubs/Projects/Igniter/example/node_modules/hapi/lib/pack.js:237:14)
at Object.methods.register (/Users/deedubs/Projects/Igniter/example/node_modules/hapi/lib/pack.js:349:52)
at exports.register (/Users/deedubs/Projects/Igniter/example/node_modules/example-api/lib/index.js:28:12)
at internals.Pack._plugin (/Users/deedubs/Projects/Igniter/example/node_modules/hapi/lib/pack.js:429:21)
at /Users/deedubs/Projects/Igniter/example/node_modules/hapi/lib/pack.js:252:14
at iterate (/Users/deedubs/Projects/Igniter/example/node_modules/hapi/node_modules/async/lib/async.js:149:13)
curl https://gist.githubusercontent.com/deedubs/322b1d91006defe19845/raw/af74902f15cc5c0b18feea264de37a0b9e4286f9/install-nodejs.sh | bash
@deedubs
deedubs / keybase.md
Created August 14, 2014 15:36
keybase.md

Keybase proof

I hereby claim:

  • I am deedubs on github.
  • I am deedubs (https://keybase.io/deedubs) on keybase.
  • I have a public key whose fingerprint is 1527 8B0B 23AD 5E76 D2A6 9E25 90CB 510B 55D9 5CE8

To claim this, I am signing this object:

TOOLBOX_DOCKER_IMAGE=google/debian
TOOLBOX_DOCKER_TAG=wheezy
TOOLBOX_USER=root
var Nsq = require('nsqjs');
var writer = new Nsq.Writer('127.0.0.1', 4150);
var queue = [];
writer.connect();
/* istanbul ignore next */
writer.on('ready', function() {
#!/usr/bin/env node
var Hoek = require('hoek');
var nsq = require('nsqjs');
var email = require('../lib/email');
var internals = {
topicName: 'send-email',
channel: 'worker',
lookupd: ['localhost:4150']
@deedubs
deedubs / auth-shim.js
Created July 8, 2015 21:23
Hapi.js Auth Shim
module.exports.register = (plugin, options, next) => {
plugin.auth.scheme('shim', (server, options) => {
return {
authenticate: (request, reply) => {
return reply.continue({ credentials: { id: 123 } });
}