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 a = ["A", "B", "A", "C", "A"], b = [], unique; | |
| for(var i=0; i < a.length; i++) { | |
| unique = true; | |
| for(var j=0; j < b.length; j++) { | |
| if(a[i] == b[j]) { | |
| unique = false; | |
| } | |
| } | |
| if(unique) { | |
| b.push(a[i]); |
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 doit() { | |
| INSANITY: | |
| for(var i=1; i < 20; i++) { | |
| if(i == 10) { | |
| continue INSANITY; | |
| } |
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
| // (~~"23.1232") // 23 | |
| // (~~"23.1.1232") // 0 | |
| // (+"23.1.1232") // NaN | |
| // +"23.1232" // "2323.1232" | |
| // parseFloat("23.1.1232", 10) // 23.1 | |
| // parseInt("23.1.1232", 10) // 23 |
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
| main_loop: | |
| mov EDX, [EBP + ECX*4 + 0C00h] | |
| movzx ECX, BH | |
| xor EDX, [EBP + ECX*4 + 0800h] | |
| shr EBX, 16 | |
| movzx ECX, BL | |
| xor EDX, [EBP + ECX*4 + 0400h] | |
| xor EDX, [ESI + 8] | |
| movzx ECX, AL | |
| movzx EBX, BH |
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 Num = function(value, options) { | |
| options = options || ["num"]; | |
| for(var o in options) { | |
| if(options[o] == "trunc") { // truncate towards zero | |
| value=~~value; | |
| } | |
| if(options[o] == "num") { // string or boolean to number |
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
| o : while (x) { | |
| while (y) { | |
| if (a) { | |
| continue o; // previously known as insanity, found a use for insanity today! =) | |
| } | |
| if (b) { | |
| continue; | |
| } | |
| } | |
| } |
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
| try { | |
| Object.create(null, {foo: { get: 0 }}); | |
| assertTrue(false); | |
| } catch (e) { | |
| assertTrue(/Getter must be a function/.test(e)); | |
| } | |
| try { | |
| Object.create(null, {foo: { set: 0 }}); | |
| assertTrue(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 queryString2JSON() { | |
| var query = {} | |
| unescape(window.location.search).replace(/[^&\?]+/g, function(a, b) { | |
| var c = a.split("="); | |
| query[c[0]] = c[1]; | |
| }); | |
| return query; | |
| } |
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
| window.Number.prototype.minus = function(n) { | |
| return (this - n); | |
| }; | |
| window.Number.prototype.plus = function(n) { | |
| return (this + n); | |
| }; | |
| window.Number.prototype.times = function(n) { | |
| return (this * n); |
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 format(v) { | |
| if(isNaN(v)) { | |
| return v; | |
| } | |
| var val = String(v).split(""), | |
| len = val.length, | |
| neg = String(v).indexOf("-"), | |
| dec = String(v).indexOf("."), | |
| offset = (dec != -1 ? (len - dec) : 0), |
OlderNewer