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(){ | |
var debouncedKeyPress; | |
function wrapper(e){ | |
var keycode = e.keyCode||e.which; | |
debouncedKeyPress(this); | |
if(keycode === 13)//prevent form submission | |
{ | |
e.preventDefault(); | |
return 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
var app = new Hoodie("http://localhost:6001/"); | |
app.account.signIn("admin", "admin").done(function (user) { | |
app.store.findAll('callback').done(function (callbacks) { | |
for (var i = 0, _len = callbacks.length; i < _len; i++) { | |
$(".target").append(JSON.stringify(callbacks[i]) + "<br />") | |
} | |
}); | |
console.log(user) | |
$("#add").click(function () { |
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 SubArray(length){ | |
Array.call(this); //"Magic" | |
if(typeof length === "number" && length%1===0&&arguments.length===1){ | |
this.length = length; //Length has to be set manually for some reason. | |
} | |
else{ | |
var _len = arguments.length; | |
this.length = _len; | |
for(var i = 0; i<_len; i++) | |
this[i] = arguments[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 arrayObject = ["What", "is", "going", 0,"on", 111,"..", "here"]; | |
String.prototype.slice.call(arrayObject); | |
//"What,is,going,0,on,111,..,here" | |
String.prototype.concat.call(arrayObject); | |
//"What,is,going,0,on,111,..,here" | |
String.prototype.substring.call(arrayObject,1,10) | |
//"hat,is,go" | |
String.prototype.indexOf.call(arrayObject, "n,111") | |
//17 |
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 topics = ["idea","examples","post some code"]; | |
//["idea","examples","post some code"] | |
topics.shift(); | |
//"idea" |
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
topics.shift(); | |
//"examples" |
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
topics.shift(); | |
//"post some code" |
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
String.prototype.template = function(templateObject){ | |
return this.replace(/\{\{([a-zA-Z\_0-9\.]*?)\}\}/g, function(match){ | |
var temp = templateObject; | |
match.slice(2,-2).split('.').forEach(function(item){ | |
temp = temp[item]; | |
}); | |
return temp; | |
}); | |
}; |
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
Object.prototype.template = function(templateStr){ | |
var that = this; | |
return templateStr.replace(/\{\{([a-zA-Z\_0-9\.]*?)\}\}/g, function(match){ | |
match.slice(2,-2).split('.').forEach(function(item){ | |
that = that[item]; | |
}); | |
return that; | |
}); | |
}; |
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 HandleBar(templateStr, templateObject){ | |
var that = templateObject; | |
return templateStr.replace(/\{\{([a-zA-Z\_0-9\.]*?)\}\}/g, function(match){ | |
match.slice(2,-2).split('.').forEach(function(item){ | |
that = that[item]; | |
}); | |
return that; | |
}); | |
}; |
OlderNewer