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 peeps = { hugh: { name: 'hugh jackson' } } | |
var titleCase = function(str){ | |
return str.split(' ').map(function(str){ return str.substr(0, 1).toUpperCase() + str.substr(1) }).join(' ') | |
} | |
var val = maybe(peeps) | |
.map(function(peeps){ return peeps.tahir }) | |
.map(function(peep){ return peep.name }) | |
.map(titleCase) | |
.getOrElse('couldn\'t find person') |
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() | |
{ | |
$.ajax({ | |
url: 'check.php', //the script to call to get data | |
success: function(data) { | |
$('#count').html(data); //Set output element html | |
} | |
}); | |
}); |
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
core.register('myModule', function(sandbox){ | |
sandbox.subscribe('init', function(){ | |
//do stuff | |
}); | |
}); |
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 deepClone(o) { | |
return (typeof o !== 'object' || o === null) ? o | |
: (o instanceof Array) ? o.map(deepClone) | |
: Object.keys(o).reduce(function (result, key) { | |
result[key] = deepClone(o[key]) | |
return result | |
}, Object.create(Object.getPrototypeOf(o))) } |
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 attachEvent(el, action, callback){ | |
if (el.addEventListener) { | |
el.addEventListener(action, callback, false); | |
} else if (el.attachEvent) { | |
el.attachEvent('on' + action, (function (ele) { return callback; })(el) ); | |
} | |
} | |
inputKeyup: function (courseType){//event that's triggered on the input keyups | |
var currentRequest; | |
return function (e){ |
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 client = new XMLHttpRequest(); | |
client.open('GET', 'maxid.php', false); | |
client.send(null); | |
maxid=client.responseText; | |
JSON.parse(maxid); | |
return maxid; |
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
for (var i = 0; i < 10; i++) { | |
process.nextTick(function (i) { console.log(i); }.bind(this, i)); | |
} | |
// Prints 10 x 10 times | |
// I want it to print 1 - 10 without using an external array to store i | |
/* | |
In browser test edition |
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 MyClass = function() { | |
this.cosa = 0; | |
console.log('constructor'); | |
}; | |
(function() { | |
var func1 = function() { | |
console.log('func1'); | |
console.log(this.cosa); | |
}; |
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
module.exports = function router() { | |
function router(method, url) { | |
var r = get_routes(method), rl = r.length | |
for (var i = 0; i < rl; ++i) { | |
if (r[i].type == 'string') { | |
if (r[i].url == url) | |
return [[url], r[i].callback] } | |
else { | |
var route = r[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
{ | |
"cmd": "init", | |
"payload": { | |
"blackboard_id": 2, | |
"data": [ | |
"{\"id\":1,\"z\":1,\"class\":\"Rectangle\",\"x\":234.5,\"y\":130.5,\"width\":297,\"height\":147,\"style\":{\"fillColor\":\"#FFFFFF\",\"strokeColor\":\"#000000\",\"strokeSize\":\"1\"},\"minWidth\":10,\"minHeight\":10,\"text\":\"Test\",\"font\":\"verdana\",\"fontSize\":\"16px\",\"fontStyle\":{\"bold\":false,\"italic\":false},\"boundingBox\":{\"x\":[234.5,383,531.5],\"y\":[130.5,204,277.5]}}", | |
"{\"id\":1,\"z\":1,\"class\":\"Rectangle\",\"x\":234.5,\"y\":130.5,\"width\":297,\"height\":147,\"style\":{\"fillColor\":\"#FFFFFF\",\"strokeColor\":\"#000000\",\"strokeSize\":\"1\"},\"minWidth\":10,\"minHeight\":10,\"text\":\"Test\",\"font\":\"verdana\",\"fontSize\":\"16px\",\"fontStyle\":{\"bold\":false,\"italic\":false},\"boundingBox\":{\"x\":[234.5,383,531.5],\"y\":[130.5,204,277.5]}}" | |
] | |
} | |
} |
NewerOlder