Skip to content

Instantly share code, notes, and snippets.

mike pearson mjpearson

Block or report user

Report or block mjpearson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View toq_answer.js
#!/usr/bin/env node
/*
refs [interview question](https://gist.github.com/mjpearson/0ea04a4ba886d3f02333)
@author michael pearson <mjpearson@gmail.com>
To turn on debugging, from shell : `export NODE_DEBUG=1`
If execute bit set on toq_answer.js, run with `cat input.txt | ./toq_answer.js`
View toq.md

Code Question --- Pattern-Matching Paths

I Was A Moron For Answering In This Way

enjoy

Problem Description

View twilio_pod_inline.js
#!/usr/bin/env node
var pod = require('bip-pod-twilio');
pod.init(
'twilio',
undefined,
{},
function(msg, level) {
console[level](msg);
},
@mjpearson
mjpearson / gist:5f2b8ded61dd9879779a
Created Oct 14, 2014
ldapjs client example - heapdump + gc
View gist:5f2b8ded61dd9879779a
#!/usr/bin/env node
var memwatch = require('memwatch'),
heapdump = require('heapdump'),
_ = require('underscore'),
ldap = require('ldapjs');
function dump() {
var f = '/tmp/node_' + process.pid + '_' + Date.now() + '.heapsnapshot';
console.log('Writing Heap Snapshot ' + f);
global.gc();
@mjpearson
mjpearson / foundationshim.js
Last active Dec 14, 2015
foundation.js shim into requirejs example
View foundationshim.js
require.config({
baseUrl : "/static/js",
paths: {
jquery: 'vendor/jquery-bundle-min',
foundation : 'vendor/foundation.min'
},
shim : {
foundation : {
deps : ["jquery" ],
@mjpearson
mjpearson / saucyparser.php
Created Apr 30, 2012
selenium test result retriever for saucelabs
View saucyparser.php
#!/usr/bin/env php
<?php
// Retrieves all selenium screenshot/video test results from saucelabs in a useful way
// quick and dirty, deal with it.
//
// cache is in /cache/{job_id} : remove any job and rerun to reprocess the job
// usable output is in /data/{domain name}/[s|v]_[html_file_name]_[browser][version][job_id][operating_system][_screenshot.png|_video.flv].
//
// @author michael pearson michael@cloudspark.com.au
@mjpearson
mjpearson / sc-dl.js
Created Mar 5, 2012 — forked from pheuter/sc-dl.js
Bookmarklet that generates download link for a Soundcloud upload
View sc-dl.js
(function(d) {
var dl = d.createElement('a');
dl.innerText = 'Download MP3';
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1];
dl.download = d.querySelector('em').innerText+".mp3";
d.querySelector('.primary').appendChild(dl);
dl.style.marginLeft = '10px';
dl.style.color = 'red';
dl.style.fontWeight = 700;
})(document);
@mjpearson
mjpearson / Zend_Plugin_Controller_AcceptDetect
Created Dec 21, 2011
zend xml/json rest predispatch plugin
View Zend_Plugin_Controller_AcceptDetect
<?php
/**
* Detects an XHTML or JSON request type based on the Accept request header
* Can optionally detect whether the request is an XHR request type for further
* routing or rendering decisions (JSONP wrappers for example)
*
*
* How to use (put in application/Bootstrap.php):
*
You can’t perform that action at this time.