I hereby claim:
- I am mzabriskie on github.
- I am mzabriskie (https://keybase.io/mzabriskie) on keybase.
- I have a public key whose fingerprint is 2B8A A1C7 D943 8BB3 7D38 C760 ECF6 90AD 2240 A96B
To claim this, I am signing this object:
var output = document.getElementById('output'); | |
var points; | |
var drawing = false; | |
function handleMouseDown() { | |
points = []; | |
output.innerHTML = ''; | |
document.addEventListener('mousemove', handleMouseMove); | |
document.addEventListener('mouseup', handleMouseUp); | |
} |
function getElement(id) { | |
var el = null; | |
if (document.getElementById) { | |
el = document.getElementById(id); | |
} | |
else if (document.all) { | |
el = document.all[id]; | |
} | |
else if (document.layers) { | |
el = document.layers[id]; |
I hereby claim:
To claim this, I am signing this object:
[].slice.call(document.querySelectorAll('tr.paper')).sort(function (a, b) { | |
a = parseInt(a.querySelector('td:first-of-type span.score').innerHTML); | |
b = parseInt(b.querySelector('td:first-of-type span.score').innerHTML); | |
return a > b ? -1 : b > a ? 1 : 0; | |
}).forEach(function (node) { | |
node.parentNode.appendChild(node); | |
}); |
I haven't been able to find any libraries for interacting with the HTML5 Gamepad API that I really like. This is an attempt to sort out some of my ideas for what I would want out of such a library and ultimately implement it.
index.html
and locale-en.json
to the same directorybash
commands belowbower install angular
bower install angular-translate
bower install angular-translate-loader-static-files
/** | |
* I have seen this a lot lately. | |
* I assume it's to give priority to the request handler for this module. | |
* Otherwise why not just add a new listener and leave existing alone? | |
*/ | |
module.exports.listen = function (server) { | |
var listeners = server.listeners('request').slice(0); | |
server.removeAllListeners('request'); | |
server.on('request', function (req, res) { | |
if (req.url.indexOf('/foo/bar.js') === 0) { |
function notify(title, options) { | |
// Let's check if the browser supports notifications | |
if (!('Notification' in window)) { | |
return; | |
} | |
function n() { | |
new Notification(title, options); | |
} |
function createXHR() { | |
if (!createXHR.__memoize) { | |
var factory = [ | |
function () {return new XMLHttpRequest()}, | |
function () {return new ActiveXObject("Microsoft.XMLHTTP")}, | |
function () {return new ActiveXObject("Msxml3.XMLHTTP")}, | |
function () {return new ActiveXObject("Msxml2.XMLHTTP")}, | |
]; | |
var xhr; |
var App = React.createClass({ | |
propDefinition: { | |
requiredStringProp: React.PropTypes.string.isRequired.default('Hello World'), | |
optionalNumberProp: React.PropTypes.number.default(12345), | |
enforcedObjectNoDefaultProp: React.PropTypes.object, | |
defaultValueNoTypeProp: true | |
} | |
}); |