First read these tweets:
- https://twitter.com/floydophone/status/491319008130392064
- https://twitter.com/mzabriskie/status/491350457395068928
and this doc:
| /** | |
| * The problem with using Promises for a request API is that Promises | |
| * make it difficult to abort the request. Typically when using XHR | |
| * some factory will wrap the actual XHR, but ultimately will return | |
| * the XHR object. | |
| * | |
| * ``` | |
| * var request = performRequest('/user/12345'); | |
| * request.abort(); | |
| * ``` |
| 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; |
| function notify(title, options) { | |
| // Let's check if the browser supports notifications | |
| if (!('Notification' in window)) { | |
| return; | |
| } | |
| function n() { | |
| new Notification(title, options); | |
| } |
First read these tweets:
and this doc:
| // Run this from your browser console on your meetup event page (http://www.meetup.com/AngularJS-Utah/events/183104032/) | |
| (function () { | |
| // Query document for attendees and select a random one | |
| const list = document.querySelector('ul.attendees-list').children, | |
| item = list[Math.floor(Math.random() * list.length)], | |
| name = item ? item.querySelector('h4.text--bold').innerText : 'N/A'; | |
| // Remove item so they can only be selected once | |
| item && item.parentNode.removeChild(item); | |
| /** | |
| * 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) { |
index.html and locale-en.json to the same directorybash commands belowbower install angular
bower install angular-translate
bower install angular-translate-loader-static-filesI 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.
| [].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 hereby claim:
To claim this, I am signing this object: