Skip to content

Instantly share code, notes, and snippets.

View arv's full-sized avatar
👋
Reflecting...

Erik Arvidsson arv

👋
Reflecting...
View GitHub Profile
@arv
arv / gist:3900474
Created October 16, 2012 16:45
ExportSpecifierSet
ExportSpecifierSet ::= "{" ExportSpecifier ("," ExportSpecifier)* "}" ("from" Path)?
| Id ("from" Path)?
| "*" ("from" Path)?
@arv
arv / gist:3900429
Created October 16, 2012 16:39
indent import
import {
variablesInFunction,
variablesInBlock,
thinger,
otherthinger,
...
} from '../semantics/VariableBinder.js';
@arv
arv / gist:3756613
Created September 20, 2012 15:28
notify
var data = 42;
var object = {
get x() {
return data;
},
set x(v) {
notifier.notify({
type: 'updated',
name: 'x',
oldValue: data
@arv
arv / ES5 + __proto__
Created June 1, 2012 22:16
Custom Elements
// And in browsers that support __proto__:
document.register('x-foo', {
extends: 'p',
prototype: {
__proto__: HTMLParagraphElement.prototype,
get foo() { return 'foo'; }
}
})
<!DOCTYPE html>
<script src="url.js"></script>
<script>
var url = new URL('http://www.example.com/a/b/c.html?p=q&r=s&p&p=t#hash');
for (var key in url) {
console.log(key, url[key]);
}
var C = 1;
function f(x = C) {
var C = 2;
return x;
}
var result = f(); // ???
@arv
arv / node-append.js
Created October 6, 2011 21:56
Node.prototype.append
(function() {
function isNode(value) {
return value instanceof Node;
}
function isAttrObject(value) {
return value != null && typeof value === 'object' && !isNode(value);
}