Skip to content

Instantly share code, notes, and snippets.

View tobie's full-sized avatar

Tobie Langel tobie

View GitHub Profile
@tobie
tobie / wpt-pr
Last active August 29, 2015 13:56
var obj = {}
githubdata.forEach(function(a) {
if (!a.pull_request) return;
var created = a.created_at.slice(0,7);
var closed = a.closed_at ? a.closed_at.slice(0,7) : null;
obj[created] = obj[created] || {};
obj[created].TOTAL_OPENED = obj[created]. TOTAL_OPENED || 0;
obj[created]. TOTAL_OPENED ++;
Opened:
2012-12: 13
2013-01: 7
2013-02: 13
2013-03: 11
2013-04: 60
2013-05: 25
2013-06: 105
2013-07: 28
[].map.call(document.querySelectorAll('.toc a'), function(node) { return node.href.split('#')[0] }).reduce(function(output, item) {
item = item.split("/");
item = item[item.length - 1];
if (output.indexOf(item) < 0) output.push(item);
return output;
}, [""])
@tobie
tobie / .mozconfig
Last active August 29, 2015 13:59
.mozconfig
# if you want to build with clang (better errors)
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
ac_add_options --disable-libjpeg-turbo
# no. of cores in your machine + 2 is a good idea.
mk_add_options MOZ_MAKE_FLAGS="-j4 -s"
ac_add_options --enable-debug
ac_add_options --enable-trace-malloc
@tobie
tobie / series
Last active August 29, 2015 14:00
qpush sw queue
Tobie-Langels-MacBook-Air:mozilla-central tobielangel$ hg tip
changeset: 179233:45ba19361b97
tag: tip
parent: 179197:bf19c003ffc3
parent: 179232:93d3946fd9e0
user: Ryan VanderMeulen <ryanvm@gmail.com>
date: Fri Apr 18 09:08:59 2014 -0400
summary: Merge inbound to m-c.
Tobie-Langels-MacBook-Air:mozilla-central tobielangel$ hg qpush 903441-sw-nointercept
Tobie-Langels-MacBook-Air:webidl2.js tobielangel$ npm test
> webidl2@2.0.4 test /Users/tobielangel/projects/webidl2.js
> mocha
Parses all of the invalid IDLs to check that they blow up correctly
◦ should produce the right error for /Users/tobielangel/projects/webidl2.js/test/widlproc/test/invalid/idl/enum.wi ✓ should produce the right error for /Users/tobielangel/projects/webidl2.js/test/widlproc/test/invalid/idl/enum.widl
◦ should produce the right error for /Users/tobielangel/projects/webidl2.js/test/widlproc/test/invalid/idl/module. ✓ should produce the right error for /Users/tobielangel/projects/webidl2.js/test/widlproc/test/invalid/idl/module.widl
@tobie
tobie / gist:54fbe04b97d0a0b0b621
Last active August 29, 2015 14:01
ResponsePromise vs. regular promises
function onerror(err) {
// do stuff
}
///////////////// Piping /////////////////
// ResponsePromise
fetch("./contacts.csv").catch(onerror).body.pipe(new CSVParser());
// Regular promise
<img src="small.jpg" alt="A rad wolf" id="my-img" />
<imgsource for="my-img">
<source media="(min-width: 36em)"
srcset="large.jpg 1024w,
medium.jpg 640w,
small.jpg 320w"
sizes="33.3vw" />
<source srcset="cropped-large.jpg 2x,
cropped-small.jpg 1x" />
</imgsource>
[NoInterfaceObject]
interface GlobalFetch {
Promise<Response> fetch(RequestInfo input, optional RequestInit init);
};
Window implements GlobalFetch;
@tobie
tobie / gist:0689c5dda8f6d49d500d
Last active August 29, 2015 14:03
Priming the cache when there's a cache miss.
this.oninstall = function(e) {
// Create a cache of resources.
var resources = new Cache();
var visited = new Cache();
// Fetch them.
e.waitUntil(resources.add(
"/index.html",
"/fallback.html",
"/css/base.css",
"/js/app.js",