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
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){ |
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
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'); |
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 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 |
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
set = function(req, res) { | |
res.cookie('login_token', +new Date(), { maxAge: 3600000, path: '/' }); | |
res.redirect('/'); | |
}; |
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
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 }) | |
}); |
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
{ | |
"id": "421b91639382f6be8886dd4bcff5db3e3821b64b2f6548f0a3db4bb168211c18", | |
"listing": { | |
"method": "psapi", | |
"indexed": "2018-06-18T12:09:49Z", | |
"stash": { | |
"name": "SELLING!", | |
"x": 3, | |
"y": 11 | |
}, |
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 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) | |
} | |
} | |
} |
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 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) | |
} |
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 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(){ |
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 x = 10 | |
var y = 10 | |
function setup() { | |
frameRate(1) | |
createCanvas(200, 200) | |
for(var i = 0; i < 10; i++) | |
setTimeout(addRect, 5000) | |
} | |
function addRect(){ |
OlderNewer