Skip to content

Instantly share code, notes, and snippets.

View aroman's full-sized avatar
👋
hiring!

Avi Romanoff aroman

👋
hiring!
View GitHub Profile
[
{
"title":"bookshelf 1",
"books":[
{
"title":"Foobar"
},
{
"title":"Bazqux"
}
@aroman
aroman / gist:2821547
Created May 28, 2012 22:55
Yo Dawg we heard you liked async
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);
},
$(window).resize(_.throttle () ->
if router.current_view
router.current_view.scrollBottom()
, 100)
@aroman
aroman / wat.coffee
Created March 22, 2013 17:42
Y U NO FIRE?
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.
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
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.
}
}
});
<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...">
<template name="quadList">
<h3>Quads:</h3>
<ul>
{{#each quads}}
{{> quad}}
{{/each}}
</ul>
</template>
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
}
User.findOne email: req.body.email, (err, doc) ->
res.send(500) if err
if doc then res.send("IN USE") else res.send("OK")