This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Support for iTunes-style m4a tags | |
| * See: | |
| * http://atomicparsley.sourceforge.net/mpeg-4files.html | |
| * http://developer.apple.com/mac/library/documentation/QuickTime/QTFF/Metadata/Metadata.html | |
| * Authored by Joshua Kifer <joshua.kifer gmail.com> | |
| */ | |
| var ID4 = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1: how could you rewrite the following to make it shorter? | |
| if (foo) { | |
| bar.doSomething(el); | |
| } else { | |
| bar.doSomethingElse(el); | |
| } | |
| 1) (foo?bar.doSomething:bar.doSomethingElse)(el); // <-- minimizers can still work here | |
| 2) bar[foo?"doSomething":"doSomethingElse"](el); // <-- goodbye method renaming |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(ul) { | |
| arr.forEach(function(text) { | |
| setupItem(ul.appendChild(document.createElement("li")), text); | |
| }) | |
| })(document.appendChild(document.createElement("ul"))); | |
| function setupItem(li, text) { | |
| li.textContent = text; | |
| li.addEventListener("click", onClick, false); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <!-- | |
| runnable version: http://jsfiddle.net/uVkHh/ | |
| Expected result: | |
| Super.foo | |
| foo: { | |
| "value": "this.foo", | |
| "writable": false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <!-- | |
| o.foo (o.hasOwnProperty("foo") === true) shouldn't be created because o's prototype "foo" descriptor has writable === false. | |
| According to the 5th version of Ecma-262 (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf): | |
| 11.13.1 Simple Assignment ( = ) | |
| The production AssignmentExpression : LeftHandSideExpression = AssignmentExpression is evaluated as follows: | |
| [...] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <script src="http://codemirror.net/lib/codemirror.js"></script> | |
| <link rel="stylesheet" href="http://codemirror.net/lib/codemirror.css"> | |
| <style> | |
| .highlight { | |
| background-color: yellow; | |
| } | |
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var foo = {c: 3}; | |
| var bar = {a: {b: {c: 3}}}; | |
| // define a binding between foo.c and bar.a.b.c, so when we change the | |
| // value of any of the two paths the new value will be copied to the | |
| // other one. | |
| Object.defineBinding(foo, "c", { | |
| boundObject: bar, | |
| boundObjectPropertyPath: "a.b.c" | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var bar = {a: {b: {c: 3}}}; | |
| // we're going to listen to changes of the bar.a.b.c value | |
| bar.addPropertyChangeListener("a.b.c", function() { | |
| console.log("bar.a.b.c was changed to: " + bar.a.b.c); | |
| }); | |
| bar.a.b.c = 4; // Outputs: bar.a.b.c was changed to: 4 | |
| bar.a = {b: {c: 6}}; // Outputs: bar.a.b.c was changed to: 6 | |
| bar.a.b.c = 3 + 3; // notification not fired, the value didn't change |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- this file should be in other.reel/other.html --> | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| <script type="text/montage-serialization">{ | |
| "owner": { | |
| "properties": { | |
| "element": {"#": "other"} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .range { | |
| width: 100%; | |
| } |
OlderNewer