I hereby claim:
- I am bnoguchi on github.
- I am bnoguchi (https://keybase.io/bnoguchi) on keybase.
- I have a public key whose fingerprint is BB2A 8AA0 7790 946A 3382 BB62 E6F3 DD87 0D8D 89D0
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
destructure = (s) -> s.split("</a>").map (x) -> title: x[x.lastIndexOf('>')+1..], url: x.match(/href="([^"]+)"/)?[1] | |
reduceCb = (mem, curr) -> mem[curr[0...curr.indexOf ':']] = destructure curr; mem | |
dataBySetNumber = json.setlistdata.split(/<span[^>]+>Set /)[1..].reduce reduceCb, {} |
// This code doesn't accept a URL of /auth/twitter or /auth/github | |
var express = require('express') | |
, routes = require('./routes') | |
, util = require('util') | |
, everyauth = require('everyauth'); | |
var app = module.exports = express.createServer(); |
bootstrapAuthentication() | |
application = express.createServer() | |
application.configure -> | |
bootstrap(application) | |
application.listen(2536) | |
bootstrapAuthentication = () -> | |
everyauth.twitter |
everyauth.password | |
.respondToLoginSucceed( function (res, user) { | |
if (user) { /* Then the login was successful */ | |
res.json({ success: true }, 200); | |
} | |
}) | |
.respondToLoginFail( function (req, res, errors, login) { | |
if (!errors || !errors.length) return; | |
return res.json({ success: false, errors: errors }); | |
}); |
module.exports = { | |
fb: { | |
appId: 'your fb app id', | |
appSecret: 'your fb app secret' | |
} | |
}; |
findOrCreateUser: function (sess, accessTok, accessTokExtra, fbUser) { | |
var promise = this.Promise() | |
, User = this.User()(); | |
if(sess.auth == null || sess.auth.userId == null) { | |
User.findOne({'fb.id': fbUser.id}, function (err, foundUser) { | |
if (foundUser) { | |
if( foundUser.confirmed ) { | |
return promise.fulfill(foundUser); | |
} else { | |
assignFbDataToUser(foundUser, accessTok, accessTokExtra, fbUser); |
var assert = require('assert'), | |
express = require('express'), | |
gzip = require('connect-gzip'); | |
var app = express.createServer(); | |
app.set('view engine', 'jade'); | |
app.use(gzip.gzip()); | |
app.use(express.bodyParser()); |
var mongoose = require('mongoose') | |
mongoose.connect('mongodb://localhost/sebtest'); | |
var Schema = mongoose.Schema; | |
var StackItemSchema = new Schema({ | |
blob: Number | |
}); | |
var StackSchema = new Schema({ |
var mongoose = require('mongoose') | |
, Schema = mongoose.Schema ; | |
mongoose.connect('mongodb://localhost/test'); | |
var NewsModelSchema = new Schema({ | |
name: String | |
, title: String | |
}); |