Skip to content

Instantly share code, notes, and snippets.

View tobie's full-sized avatar

Tobie Langel tobie

View GitHub Profile
1. If |F| corresponds to an attribute, operation or stringifier, then return
the global environment associated with the
[=interface=] that definition appears on.
1. Otherwise, if |F| corresponds to an indexed or named property, then return
the global environment associated with the interface that
the indexed or named property getter, setter or deleter was defined on.
// Moved to https://github.com/tobie/htmldiff-nav/blob/master/index.js
Primarily by grouping types into larger categories, but also by recategorizing callback interfaces as more like dictionaries than normal interfaces.
Fixes #50 and #59.
<!--
This comment and the below content is programatically generated.
You may add a comma-separated list of anchors you'd like a
direct link to below (e.g. #idl-serializers, #idl-sequence):
#dfn-distinguishable
<h1>Foo</h1>
<pre class=metadata>
Group: test
Shortname: foo
Level: 1
Status: ED
Group: dap
ED: http://example.com/foo
Abstract: Abstract content.
@tobie
tobie / index.bs
Last active July 31, 2016 12:06
Why is oldids taking precedence here?
<h4 oldids="dom-sequence" id="idl-sequence" interface="" dfn="" lt="sequence|sequence&lt;T&gt;">Sequences — sequence&lt;|T|&gt;</h4>
<p>
The {{sequence&lt;T&gt;}}
type is a parameterized type whose values are (possibly zero-length) sequences of
values of type |T|.
</p>
@tobie
tobie / whatfreq.js
Last active September 7, 2015 08:04
Sensor sample frequency
// Trying to find the formula to determine the frequency
// at which to sample GPS coordinates of a moving vehicle
// in order to have the maximum precision but not to store
// more data than necessary.
let precision = 1; // The precision of the GPS in meters
let max_speed = 180 / 3.6 // 180km/h converted to m/s = 50m/s
let max_frequency = max_speed / precision;
// Nyquist–Shannon sampling theorem[1] tells us a
@tobie
tobie / _design_xxx.js
Created June 30, 2015 13:45
CouchDB design doc
module.exports = {
_id: "_design/xxx",
views: {
by_date: {
map: function(doc) {
var parts = doc._id.split(":");
emit(parts, { shortname: parts[0], date: parts[1] });
}
},
updates_by_date: {
function uniq(sortedArray) {
var output = [];
sortedArray.reduce(function(previous, current) {
if (current != previous) {
output.push(current);
}
return current;
}, null);
return output;
}
{
"html5": {
"authors": [
"Ian Hickson",
"Robin Berjon",
"Steve Faulkner",
"Travis Leithead",
"Erika Doyle Navara",
"Edward O'Connor",
"Silvia Pfeiffer"
@tobie
tobie / gist:ee9f00d6cefc35f104f7
Last active August 29, 2015 14:11
Search term highlighter for well-formed HTML content.
function highlight(str, searchString) {
var regexp = new RegExp("(<[^>]+>)|(" + searchString + ")", "gi");
return (str || "").replace(regexp, function wrap(_, tag, txt) {
if (tag) return tag;
return "<strong class=\"highlight\">" + txt + "</strong>";
});
}