This file contains 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 async = { | |
waterfall: function (listOfRequests, callback) { | |
var callbacks = 0; | |
function handleCallback() { | |
callbacks++; | |
if (callbacks === listOfRequests.length) { | |
callback(); | |
} else { | |
listOfRequests[callbacks](handleCallback); | |
} |
This file contains 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 mune(){ | |
var a=Array.isArray(arguments[0]) ? arguments[0] : arguments; | |
for(var i=0,l=a.length,l=l>31?31:l;i<l;i++){this[a[i]] = 1 << i} | |
} |
This file contains 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 _ = (function () { | |
function lo() { } | |
lo.prototype = { | |
//XMLHttpRequest wrapper | |
ajax: function() { | |
var a = arguments, | |
requestData, | |
opts = { method: 'GET', data: null, url: '', async: true, done: null, fail: null, always: null }; | |
This file contains 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
/* | |
Copyright (C) 2021 Pascal de Vink (Tweakers.net) | |
This library is free software; you can redistribute it and/or | |
modify it under the terms of the GNU Lesser General Public | |
License as published by the Free Software Foundation; either | |
version 2.1 of the License, or (at your option) any later version. | |
This library is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains 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
#me { | |
-webkit-animation: rotation 2s infinite linear; | |
-moz-animation: rotation 2s infinite linear; | |
-o-animation: rotation 2s infinite linear; | |
animation: rotation 2s infinite linear; | |
} | |
@-webkit-keyframes rotation { | |
from {-webkit-transform: rotatex(0deg);} | |
to {-webkit-transform: rotatex(359deg);} |
This file contains 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 htmlDecode(s) { | |
var el = document.createElement("div"); | |
el.innerHTML = s; | |
return el.textContent; | |
} | |
function htmlEncode(s) { | |
var el = document.createElement("div"); | |
el.textContent = s; | |
return el.innerHTML; |
This file contains 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 keys; | |
document.addEventListener('keydown', function (e) { | |
e = e ? e : window.event; | |
keys[e.keyCode] = true; | |
}); | |
document.addEventListener('keyup', function (e) { | |
e = e ? e : window.event; | |
keys[e.keyCode] = false; | |
}); |
This file contains 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
0 = Black | |
8 = Gray | |
1 = Blue | |
9 = Light Blue | |
2 = Green | |
A = Light Green | |
3 = Aqua | |
B = Light Aqua | |
4 = Red | |
C = Light Red |
This file contains 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 Promise(o, fnNames){ | |
fnNames = fnNames || ['done', 'fail', 'always']; | |
var done = fnNames[0], | |
fail = fnNames[1], | |
always = fnNames[2]; | |
o.states = { none: 0 }; | |
o.states[done] = 1; | |
o.states[fail] = 2; | |
This file contains 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
/** | |
* Converts a BGR base10 color to an RGB Hex value. | |
* | |
* @method colorToHexString | |
* @param {Integer} dColor A color as integer. | |
* @returns {String} The RGB hex code as string. | |
*/ | |
function colorToHexString(dColor) { | |
return '#' + ("000000" + (((dColor & 0xFF) << 16) + (dColor & 0xFF00) + ((dColor >> 16) & 0xFF)).toString(16)).slice(-6); | |
} |
OlderNewer