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 isAuthorized(req, res, next) { | |
if (req.headers.authorization) { | |
// compare access token with db | |
if (everythingok) | |
RETURN next() | |
} | |
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
ngOnChanges(changes: SimpleChanges) { | |
if (this.currentSlide !== undefined && !changes.currentSlide.firstChange) { | |
this.move(); | |
this.renderer.setElementClass(this.carouselItems[(this.currentSlide + this.center) % this.carouselItems.length ], 'faded', true); | |
this.renderer.setElementClass(this.carouselItems[(this.currentSlide + this.center + 1) % this.carouselItems.length], 'faded', true); | |
this.setFade(); | |
this.setFade(); | |
} | |
} |
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
module.exports = function ($scope, $state, Search) { | |
$scope.searchString = function() { | |
$scope.questions = Search.query({queryString : $scope.queryString}) | |
$state.go('search'); | |
// $state.go('search', {questions: [{body : "asd"}]}); | |
} | |
}; |
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
Model.resizeAvatar = function (user, done) { | |
var src = user.facebook.avatar | |
, filename = user._id.toString() | |
, url = '/avatars/' + filename; | |
if(src.indexOf('http') == -1 || src.indexOf('https') == -1) { | |
src = 'http:'+src; | |
}; | |
debug("avatar :", user.facebook.avatar) | |
debug("avatar src:", src) | |
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
Thu, 14 Mar 2013 15:42:54 GMT app:models:user facebook login { token: 'AAAGInZCOGfQYBACDR8LeX493NPFGeJI6NYEKS6jKR8stj6ZAxaVuXOI1qZCWz0A8M7S0ZCC90XBZADwRQESccTAmxnhlah3vYAlFl4qWpsAZDZD', | |
id: '765178541', | |
data: | |
{ id: '765178541', | |
name: 'Carolina Urquhart', | |
first_name: 'Carolina', | |
last_name: 'Urquhart', | |
link: 'http://www.facebook.com/carolina.urquhart', | |
username: 'carolina.urquhart', | |
gender: 'female', |
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.getUntrackedSimilar = function(user, done) { | |
var excludeIds = user.similarTracked || []; | |
excludeIds.push(user._id); | |
User | |
.find({ | |
_id: {$nin : excludeIds}, | |
tags: {$in: user.tags}, | |
name : {$exists : true, $ne : null, $ne : ""} | |
}, {limit: 5}, function(err, users) { |
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.similar = function(user, done) { | |
User | |
.find({ | |
_id: {$ne: user._id}, | |
tags: {$in: user.tags}, | |
name : {$exists : true, $ne : null, $ne : ""} | |
}, {limit: 5}, function(err, users) { | |
// Temporary fix for avoiding users with name :"" | |
if (users) { | |
console.log("users", users.map(function(user){return user.name})); |
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
// Gets user avatar url | |
router.get('/:userId/avatar', function(req, res) { | |
console.log("User", req.user.pictureUrl); | |
if (req.user.pictureUrl) { | |
console.log("redirecting avatar") | |
res.redirect(req.user.pictureUrl) | |
} else { | |
console.log("redirecting default") | |
res.redirect('/img/userProfileAvatar.png') | |
} |
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
// Gets user avatar url | |
router.get('/:userId/avatar', function(req, res) { | |
User.findOne({}, function(err, user) { | |
res.redirect(user.pictureUrl); | |
}); | |
}) |
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
{ | |
"author": "", | |
"name": "starscape-app", | |
"version": "0.0.2", | |
"private": true, | |
"dependencies": { | |
"express": "~3.0.0", | |
"monk": "~0.5.0", | |
"starscape-auth": "git+ssh://[email protected]:Igniter/starscape-auth.git#master", | |
"starscape-models": "git+ssh://[email protected]:Igniter/starscape-models.git#master", |
NewerOlder