Skip to content

Instantly share code, notes, and snippets.

passport.use(new FacebookStrategy({
clientID: configAuth.facebookAuth.clientID,
clientSecret: configAuth.facebookAuth.clientSecret,
callbackURL: configAuth.facebookAuth.callbackURL,
passReqToCallback: true
},
function(req, accessToken, refreshToken, profile, done) {
process.nextTick(function(){
//user is not logged in yet
User.findOne({'facebook.id': profile.id}, function(err, user){
router.get('/unlink/facebook', function(req, res){
var user = req.user;
user.facebook.token = null;
user.save(function(err){
if(err)
throw err;
if(!hasActiveLink(user))
res.redirect('/auth/logout');
var fs = require('fs'),
S3FS = require('s3fs'),
s3fsImpl = new S3FS('mybucket-BrentsTest', {
accessKeyId: 'XXXXXXXXXXXXX',
secretAccessKey: 'XXXXXXXXXXXX'
});
var multiparty = require('connect-multiparty'),
multipartyMiddleware = multiparty();
// Create our bucket if it doesn't exist
set = function(req, res) {
res.cookie('login_token', +new Date(), { maxAge: 3600000, path: '/' });
res.redirect('/');
};
router.get('/testAPI', function(req, res, next){
//if there is a access token, proceed with bearer auth
if(req.query.access_token) next();
//skips this router stack
else next('route');
}, passport.authenticate('bearer', { session: false }),
function(req, res, next){
res.json({ SecretData: 'abc123', Authenticated: true })
});
{
"id": "421b91639382f6be8886dd4bcff5db3e3821b64b2f6548f0a3db4bb168211c18",
"listing": {
"method": "psapi",
"indexed": "2018-06-18T12:09:49Z",
"stash": {
"name": "SELLING!",
"x": 3,
"y": 11
},
function search(node){
if(node == null) return;
node.setActive(true)
for(var i = 0; i < node.links.length; i++){
if(node.links[i].active == false){
drawGrid()
setTimeout(search(node.links[i]), 50)
}
}
}
function search(node, trace){
var arr = trace;
if(!found){
if(node == null) return;
if(node.y == 7 && node.x == 8){
found = true;
traceRoute = trace;
node.setActive(true)
}
function drawGrid(){
for (var i = 0; i < cols; i++) {
for (var j = 0; j < rows; j++) {
grid[i][j].draw() //grid is a 2D array of nodes
}
}
}
//inside node class
draw(){
var x = 10
var y = 10
function setup() {
frameRate(1)
createCanvas(200, 200)
for(var i = 0; i < 10; i++)
setTimeout(addRect, 5000)
}
function addRect(){