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
[ | |
{ | |
"title":"bookshelf 1", | |
"books":[ | |
{ | |
"title":"Foobar" | |
}, | |
{ | |
"title":"Bazqux" | |
} |
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 interator_func = function(array_element, callback) { | |
wraps_waterfall('foo', function (err, top_level_data) | |
async.waterfall([ | |
function(wf_callback) { | |
// do work | |
wf_callback(null, 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
$(window).resize(_.throttle () -> | |
if router.current_view | |
router.current_view.scrollBottom() | |
, 100) |
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 = require "http" | |
querystring = require "querystring" | |
options = | |
hostname: 'www.google.com', | |
path: '/', | |
method: 'GET' | |
req = http.request options, (res) -> | |
This file has been truncated, but you can view the full file.
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
5.google.com | |
6.google.com | |
7.google.com | |
8.google.com | |
9.google.com | |
10.google.com | |
11.google.com | |
12.google.com | |
13.google.com | |
14.google.com |
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
Template.quad.events({ | |
'keydown input.add-task': function (e) { | |
if (e.keyCode == 13) { | |
Quads.update({_id: this._id}, {$push: {tasks: {"body": e.target.value}}}); | |
$(e.target).focus(); // doesn't focus. | |
} | |
} | |
}); |
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
<template name="quad"> | |
<li>{{name}}</li> | |
{{#isolate}} | |
<ul> | |
{{#each tasks}} | |
<li>{{body}}</li> | |
{{/each}} | |
</ul> | |
{{/isolate}} | |
<input type="text" class="add-task" placeholder="Add a new task..."> |
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
<template name="quadList"> | |
<h3>Quads:</h3> | |
<ul> | |
{{#each quads}} | |
{{> quad}} | |
{{/each}} | |
</ul> | |
</template> |
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
User.findOne({"email": req.body.email", function (err, doc) { | |
if (err) { | |
// The query returned an error and we should either ignore | |
// it or do like a 500 error or something. | |
} else { | |
if (doc) { | |
// email exists | |
} else { | |
// email doesn't exist | |
} |
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
User.findOne email: req.body.email, (err, doc) -> | |
res.send(500) if err | |
if doc then res.send("IN USE") else res.send("OK") |