This file contains hidden or 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
$dd if=/dev/zero of=/root/myswapfile bs=1M count=1024 | |
$chmod 600 /root/myswapfile | |
mkswap /root/myswapfile | |
swapon /root/myswapfile |
This file contains hidden or 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
//javascript for the main page// | |
var initView = function(){ | |
//initialize a model | |
var Friend = Backbone.Model.extend({ | |
name : null, | |
initialize : function(){ | |
this.name = null; | |
} | |
}); |
This file contains hidden or 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
if(username && password){ | |
$.post('/login', $(this).serialize(), function(response){ | |
if(response.retStatus === 'success'){ | |
$('#loginForm').hide(); | |
$('#signup-btn').hide(); | |
$(location).attr('href', '/'); | |
}else if(response.retStatus === 'failure'){ | |
$('#signup-error-modal').modal('show'); | |
} | |
}); |
This file contains hidden or 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
app.dynamicHelpers({ | |
session : function(req, res){ | |
return req.session; | |
}, | |
someInfo : function(req, res){ | |
//getting, setting, and manipulation | |
return someAwesomeInfo; | |
}, | |
This file contains hidden or 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
/** | |
* Logout the current user and clear the session | |
*/ | |
app.get('/logout', function(req, res){ | |
logger.log('Serving request for url [GET] ' + req.route.path); | |
req.session.user = undefined; | |
res.redirect('/'); | |
}); |
This file contains hidden or 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
-if(session.user) | |
div#logoutsection.pull-right | |
a#logout-btn.btn.btn-info.pull-right.top-bar-form-button(href='logout/') Logout | |
p#loginprompt.pull-right.login-prompt #{session.user.username} | |
small logged In | |
-else | |
ul.pull-right | |
li | |
a#signup-btn.btn.pull-right.top-bar-form-button(href='#signup-modal', data-toggle="modal") Sign Up | |
form.pull-right.form-horizontal.top-bar-form(method="post", id="loginForm") |
This file contains hidden or 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
app.dynamicHelpers({ | |
session : function(req, res){ | |
return req.session; | |
} | |
}); |
This file contains hidden or 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
req.session.user = user; |
This file contains hidden or 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
app.post('/login', function(req, res){ | |
logger.log('Serving request for url [POST] ' + req.route.path); | |
var username = req.body.User; | |
var password = req.body.Password; | |
/** | |
* The following can be replaced by any other form | |
* of authentication | |
*/ | |
User.validateUser(username, password, function(err, user){ |