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 request = require('request'), | |
cheerio = require('cheerio'); | |
if (process.argv.length !== 3) { | |
console.log('Usage: node roster.js <country>'); | |
process.exit(1); | |
} | |
var country = process.argv[2]; |
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
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Global Leak - Mocha Test</title> | |
<link rel="stylesheet" href="https://raw.github.com/visionmedia/mocha/master/mocha.css" /> | |
<script src="https://raw.github.com/visionmedia/mocha/master/mocha.js"></script> | |
<script> | |
mocha.setup({ui: 'bdd', globals: ['XMLHttpRequest']}) | |
</script> |
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 mongoose = require('mongoose'), | |
Schema = mongoose.Schema | |
mongoose.connect('mongodb://localhost/my_database') | |
// Define User Schema | |
var UserSchema = new Schema({ | |
name: {type: String} | |
}) | |
var User = mongoose.model('User', UserSchema) |
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
if (typeof Object.create !== 'function') { | |
Object.create = function(o) { | |
var F = function() {}; | |
F.prototype = o; | |
return new F(); | |
} | |
}; |
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
app.post('/recover_password', function(req, res) { | |
User.get(req.body.username, function(err,data) { | |
if (err) { | |
req.session.error = 'We could not find this user.'; | |
res.redirect('back'); // ERROR THROWN HERE | |
} else { | |
var user = new User(data); | |
user.resetPassword(function(err,data) { | |
var newUser = new User(data); | |
newUser.sendPasswordRecoveryEmail(); |
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 db = require('riak-js').getClient({port: 8098, debug: false}); | |
db.save('memberships', '1', {user_id: 'luc', group_id: "barca_fans"}); | |
db.getAll('memberships', {where: { user_id: 'luc' }}, function(err,data) { console.log(data) }); | |
db.getAll('memberships', {where: { user_id: 'mourinho' }}, function(err,data) { console.log(data) }); |
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
#!/bin/sh | |
NAME=$1 | |
if [ "$NAME" == '' ] | |
then | |
echo "$0 <certificate name>" 1>&2 | |
exit 1 | |
fi | |
openssl genrsa 1024 | openssl pkcs8 -topk8 -nocrypt -out $NAME.key |