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
/** | |
* | |
* @param {function():*} action | |
* @param {function(*)} callback | |
*/ | |
window.watch = function (action, callback) { | |
var watcherId = setInterval(function () { | |
var element = action(); | |
if (element) { | |
clearInterval(watcherId); |
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 is a utility. | |
* should NOT be used in production! | |
*/ | |
function sortJSON(object) { | |
if (object instanceof Array) { | |
for (var i = 0; i < object.length; i++) { | |
object[i] = sortJSON(object[i]); | |
} | |
return object; |
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
<?php | |
if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ | |
list($ip) = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']); | |
$ip = trim($ip); | |
}else{ | |
$ip = $_SERVER['REMOTE_ADDR'] | |
} | |
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
/** | |
* | |
* @param {number} i | |
* @returns {string} | |
*/ | |
function INET_NTOA(i) | |
{ | |
var ip = []; | |
ip[0] = (i >> 24) & 0xFF; | |
ip[1] = (i >> 16) & 0xFF; |