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 extend = require('node.extend'), | |
redis = require("redis"), | |
client = redis.createClient(); | |
exports.viewHost = function(req, res){ | |
client.hgetall(req.params.hostName, function (err, replies) { | |
res.json(extend({host: req.params.hostName}, replies)); | |
}); | |
}; |
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 jsonObj = new Object(); | |
client.SMEMBERS("hosts", function (err, replies) { | |
replies.forEach(function(host){ | |
client.HGETALL(host, function(err, repliesHost){ | |
jsonObj[host] = new extend({host: host}, repliesHost); | |
console.log(jsonObj[host]); | |
}); |
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 passwordHash = require('password-hash'), | |
redis = require("redis"), | |
client = redis.createClient(), | |
extend = require('node.extend'); | |
exports.list = function(req, res){ | |
/*if(!req.session.auth){ | |
res.redirect('login?redirect=hosts'); | |
}*/ |
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 Player(name, chips, cards) { | |
this.name = name; | |
this.chips = chips; | |
this.cards = cards || []; | |
} | |
function Card(suit, number) { | |
this.suit = suit; | |
this.number = number; | |
} |
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 texasHoldem = { | |
game: { | |
potSize: 0, | |
players: 0, | |
player: {}, | |
bet: {} | |
}, | |
makeGame: function (playersArray) { | |
this.game.player = playersArray; |
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 texasHoldem = (function(){ | |
var game = { | |
pot_size: 0, | |
players: 0, | |
player: [], | |
bet: {}, | |
deck: [] | |
}; | |
function makeDeck() { |
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
connection.query('INSERT INTO users (name, password) VALUES ("'+req.body.name+'", "'+hashedPassword+'")' , function(err, rows, fields) { | |
if (err) throw err; | |
res.json({actionMessage:"User <i>"+req.body.username+"</i> committed "} ); | |
}); |
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
//ip.json | |
{ | |
"192.168.2.1" : { | |
"pass" : true | |
}, | |
"0.0.0.0" : { | |
"pass" : true | |
}, | |
"300.2.3333" : { | |
"pass" : false |
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
$( window ).unload(function() { | |
uloadEvent(); | |
}); | |
window.onunload=function(){ | |
uloadEvent(); | |
}; | |
body.onunload=function(){ | |
uloadEvent(); |
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
//requires https://github.com/janl/mustache.js | |
//requires jQuery | |
if (typeof $jq === 'undefined') $jq = {}; | |
$( document ).ready(function(){ | |
$( '[jq-repeat]' ).each(function(key, value){ | |
var $this = $(value); | |
var repeatId = $this.attr('jq-repeat') ; | |
var tempId = repeatId + 'Template'; |
OlderNewer