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 o = { | |
id: 34, | |
name: "Narendra", | |
tags: ["js", "html5"], | |
work: { | |
type: "developer", | |
language: "JavaScript", | |
} | |
}; |
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
Number.prototype.times = function(callback){ | |
for(var i=0; i< this; i++){ | |
callback(i); | |
} | |
}; | |
(5).times(function(i){ | |
console.log(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
function addEvents(module){ | |
if (module.events !== undefined) { | |
_.each(module.events, function(handler, key) { | |
var arr = key.split(" "); | |
var method = arr.shift(); | |
var hash = arr.join(" "); | |
if (hash === "") { | |
module.$$.on(method, function(e) { | |
try { | |
module[handler].call(module, e, e.target, e.target.dataset); |
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
initSlideshow( | |
document.getElementbyId("myDiv"), | |
{ | |
"title": "Cat Slideshow", | |
"images": [ | |
{ | |
"caption": "Time to Prayer", | |
"path": "images/200_cute_cat_praying-1920x1200.jpg" | |
}, | |
{ |
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
//@nsisodiya | |
//MIT | |
function addProperty(obj, prop, getCallback, setCallback){ | |
var v; | |
Object.defineProperty(obj, prop, { | |
enumerable: true, | |
configurable: true, | |
get: function() { | |
getCallback(v); | |
return v; |
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
// ./api/controllers/KharchaController.js | |
module.exports = { | |
filter: function (req, res) { | |
console.log(req.session.user.auth.id); | |
Kharcha.find().where({ | |
userId:req.session.user.auth.id | |
}).exec(function(err, data) { | |
if (err) return next(err); | |
res.json(data); |
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
//Destroy One Record | |
delete /:modelIdentity/:id | |
* /:modelIdentity/destroy/:id | |
//Find One Record | |
get /:modelIdentity/:id |
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
"http-server": { | |
dev: { | |
root: "src", | |
port: 8080, | |
host: "127.0.0.1", | |
cache: -1, | |
showDir: true, | |
autoIndex: true, | |
ext: "html", | |
runInBackground: true, |
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
app.use('*', function (req, res, next) { | |
console.log("Generic Req"); | |
console.log(req.baseUrl); | |
if(req.baseUrl.indexOf("/data/") === 0){ | |
//Data Request !! | |
next(); | |
}else{ | |
//View Request | |
res.render('index', {}); |
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 students = [{ | |
name:"A", | |
id:"aaa", | |
subject:"Math" | |
},{ | |
name:"B", | |
id:"bbb", | |
subject:"Math" | |
},{ | |
name:"C", |