Skip to content

Instantly share code, notes, and snippets.

Avatar

Tobie Langel tobie

View GitHub Profile
View wpt-pr
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 ++;
View gist:9090173
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
View multi-page specs
[].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 Aug 29, 2015
.mozconfig
View .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 Aug 29, 2015
qpush sw queue
View series
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
View gist:c3e5897aa8339f225b64
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 Aug 29, 2015
ResponsePromise vs. regular promises
View gist:54fbe04b97d0a0b0b621
function onerror(err) {
// do stuff
}
///////////////// Piping /////////////////
// ResponsePromise
fetch("./contacts.csv").catch(onerror).body.pipe(new CSVParser());
// Regular promise
View gist:3b77c6db3fe3f52286e2
<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>
View NoInterfaceObject
[NoInterfaceObject]
interface GlobalFetch {
Promise<Response> fetch(RequestInfo input, optional RequestInit init);
};
Window implements GlobalFetch;
@tobie
tobie / gist:0689c5dda8f6d49d500d
Last active Aug 29, 2015
Priming the cache when there's a cache miss.
View gist:0689c5dda8f6d49d500d
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",