Skip to content

Instantly share code, notes, and snippets.

View heapwolf's full-sized avatar
🕷️
Vault of the Black Spiders

heapwolf heapwolf

🕷️
Vault of the Black Spiders
View GitHub Profile
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]);
function doit() {
INSANITY:
for(var i=1; i < 20; i++) {
if(i == 10) {
continue INSANITY;
}
// (~~"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
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
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
o : while (x) {
while (y) {
if (a) {
continue o; // previously known as insanity, found a use for insanity today! =)
}
if (b) {
continue;
}
}
}
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);
function queryString2JSON() {
var query = {}
unescape(window.location.search).replace(/[^&\?]+/g, function(a, b) {
var c = a.split("=");
query[c[0]] = c[1];
});
return query;
}
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);
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),