Skip to content

Instantly share code, notes, and snippets.

Avatar

William Mantly wmantly

View GitHub Profile
View api.js
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));
});
};
View gist:8698302
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]);
});
View gist:8698481
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');
}*/
View gist:8777191
function Player(name, chips, cards) {
this.name = name;
this.chips = chips;
this.cards = cards || [];
}
function Card(suit, number) {
this.suit = suit;
this.number = number;
}
View gist:8777234
var texasHoldem = {
game: {
potSize: 0,
players: 0,
player: {},
bet: {}
},
makeGame: function (playersArray) {
this.game.player = playersArray;
View gist:8777665
var texasHoldem = (function(){
var game = {
pot_size: 0,
players: 0,
player: [],
bet: {},
deck: []
};
function makeDeck() {
View gist:8960923
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 "} );
});
View gist:791ff30b27bfde9dc581
//ip.json
{
"192.168.2.1" : {
"pass" : true
},
"0.0.0.0" : {
"pass" : true
},
"300.2.3333" : {
"pass" : false
View gist:4dcac296294f7be58a22
$( window ).unload(function() {
uloadEvent();
});
window.onunload=function(){
uloadEvent();
};
body.onunload=function(){
uloadEvent();
View gist:7c3c2f63129cf33a15ae
//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';