Skip to content

Instantly share code, notes, and snippets.

@pwmckenna
pwmckenna / template.travis.yml
Last active July 25, 2018 02:19
template for a .travis.yml file that tells travis to build your master branch using `yeoman build` and deploy the output to your project's gh-pages branch.
# This .travis.yml file instructs travis-ci.org to build your master branch using `yeoman build`
# and deploy the output to your project's gh-pages branch.
#
# You must sign into travis-ci.org and set the commit hook on your project for travis to
# run on your project. You also need to replace the env variables below. The secure: variable
# must be generated by running `travis encrypt` on a github oauth key that you can generate using
# curl.
language:
node_js
import debug from 'debug';
const log = debug('worker');
log('doing some work');
var taskComplete = q.defer();
queue.pop(taskComplete.promise).then(function (message) {
var tasks = transcode(message).then(torrentize).then(makePreviews);
// This will basically pipe the output of everything we're doing into the taskComplete promise...
// so if tasks is rejected, the message will be put back into the queue and we'll receive it
// again in this callback
taskComplete.resolve(tasks);
});
@pwmckenna
pwmckenna / sqs-http.js
Created June 28, 2013 20:40
sqs http request
var _ = require('underscore');
var crypto = require('crypto');
var sign = function (type, queryUrl, parameters) {
var raw = type + '\n';
raw += url.parse(queryUrl).host + '\n';
raw += url.parse(queryUrl).path + '\n';
var sorted = _.map(parameters, function (v, k) {
return [k, v];
@pwmckenna
pwmckenna / remove.js
Created April 25, 2013 16:38
remove torrents
var firstTorrent = btapp.get('torrent').at(0);
firstTorrent.remove(); // leaves the downloaded content
var specificTorrent = btapp.get('torrent').get('088529EC697C3D2AE7E1D10541CCE5287B44918C');
specificTorrent.remove(3); //removes both torrent and content
@pwmckenna
pwmckenna / gist:5423834
Last active December 16, 2015 10:58
firebase node bug
/Users/pwmckenna/git/todium-stats/node_modules/firebase/lib/firebase-node.js:95
is.o===m)&&nd(a)}};function Ed(a,b,c,d,e){for(var g=a.get(b),h=o,i=g.ma.length
^
TypeError: Cannot read property 'ma' of undefined
at Ed (/Users/pwmckenna/git/todium-stats/node_modules/firebase/lib/firebase-node.js:95:211)
at Fd (/Users/pwmckenna/git/todium-stats/node_modules/firebase/lib/firebase-node.js:96:88)
at Bd.hc (/Users/pwmckenna/git/todium-stats/node_modules/firebase/lib/firebase-node.js:95:458)
at Ld.r.hc (/Users/pwmckenna/git/todium-stats/node_modules/firebase/lib/firebase-node.js:108:258)
at G.Ub (/Users/pwmckenna/git/todium-stats/node_modules/firebase/lib/firebase-node.js:13:136)
at /Users/pwmckenna/git/todium-stats/lib/todium-tracker.js:12:31
@pwmckenna
pwmckenna / an.html
Created February 26, 2013 21:46
an's frontend guild code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title>lazy CPA config tool</title>
<SCRIPT language="javascript">
function toggle_enabled(tableID) {
try {
var table = document.getElementById(tableID);
@pwmckenna
pwmckenna / gist:4323827
Created December 18, 2012 00:35
liveOnce extension to backbrace.js's live function
(function() {
var liveOnceExtension = {
liveOnce: function(selectors, callback, context) {
var _this = this;
var wrapper = function() {
_this.die(selectors, wrapper, context);
callback.apply(this, arguments);
}
this.live(selectors, wrapper, context);
}
btapp = new Btapp;
btapp.connect();
btapp.on('plugin:update_plugin', function(options) { options.update = false; });
btapp.get('os').browse_for_files(function(files) {
console.log(JSON.stringify(files, null, 4));
/**
OLD RETURN VALUES
["/Users/pwmckenna/Documents/caitlin/humerus anteriorl view.jpg", ...]
NEW RETURN VALUES
[
{
"handle": 812535217,