This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require.config({ | |
baseUrl : "/static/js", | |
paths: { | |
jquery: 'vendor/jquery-bundle-min', | |
foundation : 'vendor/foundation.min' | |
}, | |
shim : { | |
foundation : { | |
deps : ["jquery" ], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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): | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var pod = require('bip-pod-twilio'); | |
pod.init( | |
'twilio', | |
undefined, | |
{}, | |
function(msg, level) { | |
console[level](msg); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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(); |