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
//Thanks to perfectionkills.com <http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/> | |
__getClass = function(val) { | |
return Object.prototype.toString.call(val) | |
.match(/^\[object\s(.*)\]$/)[1]; | |
}; | |
var whatis = function(val) { | |
if(val === undefined) | |
return 'undefined'; |
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 def = function(functions, parent) { | |
return function() { | |
var types = []; | |
var args = []; | |
eachArg(arguments, function(i, elem) { | |
args.push(elem); | |
types.push(whatis(elem)); | |
}); | |
if(functions.hasOwnProperty(types.join())) { | |
return functions[types.join()].apply(parent, args); |
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 namespace = function(str, root) { | |
var chunks = str.split('.'); | |
if(!root) | |
root = window; | |
var current = root; | |
for(var i = 0; i < chunks.length; i++) { | |
if (!current.hasOwnProperty(chunks[i])) | |
current[chunks[i]] = {}; | |
current = current[chunks[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
import threading | |
def set_interval(func, sec): | |
def func_wrapper(): | |
set_interval(func, sec) | |
func() | |
t = threading.Timer(sec, func_wrapper) | |
t.start() | |
return t |
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 _rmod = _rmod || {}; //require module namespace | |
_rmod.LOADED = false; | |
_rmod.on_ready_fn_stack = []; | |
_rmod.libpath = ''; | |
_rmod.imported = {}; | |
_rmod.loading = { | |
scripts: {}, | |
length: 0 | |
}; |
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
<?php | |
function request($url) { | |
$c = curl_init(); | |
curl_setopt($c, CURLOPT_URL, $url); | |
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 3); | |
curl_setopt($c, CURLOPT_TIMEOUT, 5); | |
curl_setopt($c, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); | |
$response = curl_exec($c); |
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
<?php | |
function request($url) { | |
$c = curl_init(); | |
curl_setopt($c, CURLOPT_URL, $url); | |
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 3); | |
curl_setopt($c, CURLOPT_TIMEOUT, 5); | |
curl_setopt($c, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); | |
$response = curl_exec($c); |
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 fancyDate(then, now, suffix) { | |
if(now === undefined) | |
now = new Date(); | |
if(suffix === undefined) | |
suffix = 'ago'; | |
var thenMs = null; | |
typeof then === 'number' ? thenMs = then : thenMs = then.getTime(); | |
var nowMs = 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
//Returns the object's class, Array, Date, RegExp, Object are of interest to us | |
var getClass = function(val) { | |
return Object.prototype.toString.call(val) | |
.match(/^\[object\s(.*)\]$/)[1]; | |
}; | |
//Defines the type of the value, extended typeof | |
var whatis = function(val) { | |
if (val === undefined) |
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
/** | |
* @file IVARTECH Map data class | |
* @author Nikola Stamatovic Stamat <[email protected]> | |
* @copyright IVARTECH http://ivartech.com | |
* @version 20130313 | |
* | |
* @namespace ivar.data | |
*/ | |
/** |
OlderNewer