Skip to content

Instantly share code, notes, and snippets.

View mgcam's full-sized avatar

mgcam

View GitHub Profile
@mgcam
mgcam / pipeline.js
Last active March 22, 2016 15:38
analogue of bash 'set -o pipefail' for Node.js pipeline of async processes (implemented via promises)
#!/usr/bin/env node
// Tested with Node.js v4.3.2
"use strict";
const spawn = require('child_process').spawn;
function createPromise(p) {
return new Promise(
@mgcam
mgcam / Outcome.pm
Created January 6, 2016 15:16
RESTful Perl Catalyst Controller handling chain URL with multiple endpoints
package npg_qc_viewer::Controller::Mqc::Outcome;
use Moose;
use MooseX::Types::Moose qw/Int/;
BEGIN { extends 'Catalyst::Controller::REST'; }
our $VERSION = '0';
__PACKAGE__->config(default => 'application/json');