Skip to content

Instantly share code, notes, and snippets.

import debug from 'debug';
const log = debug('worker');
log('doing some work');
@pwmckenna
pwmckenna / makeNodeResolver.js
Last active August 29, 2015 14:24
Q makeNodeResolver/nodeify
defer.makeNodeResolver = function () {
return function (err, res) {
if (err) {
this.reject(err);
} else {
this.resolve(res);
}
};
};
@pwmckenna
pwmckenna / Gryo.h
Created April 8, 2015 20:47
react-native gyro
//
// Gyro.h
// CustomComponent
//
// Created by Patrick Williams on 4/7/15.
//
#import "RCTBridge.h"
#import <CoreMotion/CoreMotion.h>
### Keybase proof
I hereby claim:
* I am pwmckenna on github.
* I am pwmckenna (https://keybase.io/pwmckenna) on keybase.
* I have a public key whose fingerprint is F6BE 52B8 CCBE 35DF F1A1 E089 709D 2816 47B4 0DDA
To claim this, I am signing this object:
var iframeProxy = new IFrameProxy({
url: 'localhost:12007'
});
Btapp.ajax = iframeProxy.ajax;
var btapp = new Btapp();
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);