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 ng-app="app"> | |
| <head> | |
| <script defer src="bootstrap/js/jquery.2.1.0.js"></script> | |
| <script src="angular/angular.1.2.11.min.js"></script> | |
| </head> | |
| <body> | |
| <script> | |
| var app = angular.module('app', []) | |
| .factory('Model', function(){ return {foo: {bar: 'initial'}}; }) |
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 f_rel(el, start, end) { | |
| // end may be < 0 and is relative to start, start must be >=0 | |
| f_abs(el, start, start + end); | |
| } | |
| function f_abs(el, start, end){ | |
| // end may be 0 < end < start, start must be >=0 | |
| var s = getSelection(); | |
| s.removeAllRanges(); |
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 * foo() { | |
| a(); | |
| yield x; | |
| b(); | |
| } | |
| // => | |
| function * foo() { | |
| var started = 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
| function* f(){ | |
| for(var i=0;;++i) { | |
| yield i; | |
| } | |
| } | |
| // => | |
| function* f(){ | |
| {var i=0;while(true) { |
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 version, can only have one var with a limited initializer | |
| // can safely reuse the new var because it can't have side effects | |
| for (var key=init in o) stmt; | |
| // => | |
| var key = init, _γ_keys = [], _γ_expro = expr; | |
| for (key in _γ_expro) _γ_keys.push(key); | |
| while (_γ_keys.length) if (expro.hasOwnProperty(key = _γ_keys.shift())) stmt; | |
| // non-var version, lhs can be any single expression | |
| // we have to create our own temp var because lhs is not "safe" |
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 version, can only have one var with a limited initializer | |
| // can safely reuse the new var because it can't have side effects | |
| for (var key=init in o) stmt; | |
| // => | |
| var key = init, _γ_keys = [], _γ_expro = expr; | |
| for (key in _γ_expro) _γ_keys.push(key); | |
| while (_γ_keys.length) if (expro.hasOwnProperty(key = _γ_keys.shift())) stmt; | |
| // non-var version, lhs can be any single expression | |
| // we have to create our own temp var because lhs is not "safe" |
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 q = Math, | |
| r = 2 * q.PI, | |
| w = q.sin, | |
| x = q.pow, | |
| y = q.max, | |
| Q = q.sqrt; | |
| // => | |
| var q=Math,w=q.sin,x=q.pow,y=q.max,Q=q.sqrt,r=2*q.PI; |
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 this_tok_mustBeString(str, nextIsExpr){ | |
| if (this_tok_getLastValue() === str) return this_tok_next(nextIsExpr); | |
| this_tok_throwSyntaxError('Expecting current value to be ['+str+'] is ['+this_tok_getLastValue()+']'); | |
| } | |
| ==> | |
| var this_tok_returnIsYield = false; | |
| function this_tok_mustBeString(str, nextIsExpr){ | |
| var tag = 'start'; |
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 this_par_parseCatch(inFunction, inLoop, inSwitch, labelSet){ | |
| if (this_tok_nextPuncIfString('catch')) { | |
| var type = this_tok_mustBeNum(0x28, false); | |
| if (type === 13) { | |
| if (this_par_isReservedIdentifier(false)) this_tok_throwSyntaxError('Catch scope var name is reserved'); | |
| this_tok_next(false); | |
| } else { | |
| this_tok_throwSyntaxError('Missing catch scope variable'); | |
| } |
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 yielding = false; | |
| function this_makeFive(n){ | |
| if (n === 3) return this_addOne(n)+1; | |
| else if (n === 1) return this_addThree(n)+1; | |
| else throw 'invalid input, can only hand 1 and 3'; | |
| } | |
| function this_addThree(n){ | |
| return this_addOne(n) + 2; | |
| } |
OlderNewer