Skip to content

Commit

Permalink
hoorizzle
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Feb 28, 2013
1 parent c0fbb11 commit fa59c42
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 17 deletions.
40 changes: 30 additions & 10 deletions play.js
Expand Up @@ -8,21 +8,41 @@ var game = express();
game.set( 'title', 'Scores' );
game.set( 'scores file', 'scores' );
game.set( 'scores', undefined );
game.set( 'default scores', JSON.stringify({
"1": "zero_cool",
"2": "abigail",
"3": "abbie",
"5": "aby",
"7": "abby",
"9": "abbey",
"13": "aby",
"21": "abbie",
"35": "abigail"
}));
game.set( 'event', new events.EventEmitter() );

game.use( express.bodyParser() );
game.use( express.static( __dirname + '/public' ) );

fs.watch(game.get( 'scores file' ), function () {
var oldScores = _.clone( game.get( 'scores' ) );
freshScores().then( function ( scores ) {
if ( !_.isEqual( oldScores, scores ) ) {
game.get( 'event' ).emit( 'refresh', scores );
}
game.set( 'scores', scores );

});
});
function watch() {
try {
fs.watch(game.get( 'scores file' ), function ( err ) {
var oldScores = _.clone( game.get( 'scores' ) );
freshScores().then( function ( scores ) {
if ( !_.isEqual( oldScores, scores ) ) {
game.get( 'event' ).emit( 'refresh', scores );
}
game.set( 'scores', scores );

});
});
} catch ( error ) {
console.warn( 'fuck, no scores file.' );
fs.writeFile( game.get( 'scores file' ), game.get( 'default scores' ), watch );
}
}
watch();

game.get( '/', function ( request, response ) {
response.redirect( '/index.html' );
Expand Down Expand Up @@ -61,7 +81,7 @@ game.get( '/get', function ( request, response ) {
response.header( 'Cache-Control', 'no-cache' );
response.send( 200, topScores( text ) );
}).fail( function () {
response.send( 404, 'FUCK' );
response.send( 200, game.get( 'default scores' ) );
});
});

Expand Down
10 changes: 4 additions & 6 deletions public/js/score.js
Expand Up @@ -18,9 +18,8 @@

var updateScores = function () {
if ( window.EventSource && typeof EventSource === "function" && !source ) {
jQuery.get( "/get", {}, processScores, "json" ).done(function() {
console.log( 'did get, now doing longget');
source = new window.EventSource( "/longget" );
jQuery.get( "get", {}, processScores, "json" ).done(function() {
source = new window.EventSource( "longget" );
source.addEventListener( "data", function ( event ) {
var data = JSON.parse( event.data );
processScores( data );
Expand All @@ -29,7 +28,7 @@
return;
} else if ( !source ) {
clearTimeout( updateScores.timeout );
jQuery.get( "/get", {}, processScores, "json" );
jQuery.get( "get", {}, processScores, "json" );
updateScores.timeout = setTimeout( updateScores, 5000 );
}
};
Expand All @@ -54,7 +53,6 @@
var amount = items.length;

for ( var i = 0; i <= amount - 1; i++ ) {
console.log( i );
var chartChildren = chart.children();
chartChildren.eq( chartChildren.length - i - 1 ).remove();
}
Expand Down Expand Up @@ -139,7 +137,7 @@
return;
} else {
playerName = playerName.trim().replace( /\s+/g, " " );
jQuery.post( "/put", { player: playerName }, postSuccess );
jQuery.post( "put", { player: playerName }, postSuccess );
}
}

Expand Down
2 changes: 1 addition & 1 deletion scores
@@ -1 +1 @@
{"0":"abi","5":"abigail","9":"chee","14":"nathan","15":"abigail","20":"joyce","24":"wright","28":"Winny","33":"Winny","36":"Winny","40":"Winny","45":"Winny4WIN","50":"vfv","54":"lol","55":"O.O","60":"WinnyWinar","62":"/j #snaek","65":"graeme","68":"abigirl","70":"WINNER","72":"BUTTOCKS","76":"lalala","81":"bam","83":"ttt","85":"booyay","90":"hi sexy <3","95":"joe","101":"Dugan Nash","106":"chee","111":"Orvil Sash","114":"fuck you","118":"omg","123":"i can't ","127":"hi mari!","130":"believe","133":"how much","139":"this game","140":"SUCKS","145":":(","151":"</span>","155":"jk","159":"but srsly","163":"im winning","168":"OH SWEET","169":"SMALLER","172":"FONT","178":"THIS IS","179":"THE","181":"WIERDEST","185":"CHATROOM ","186":"I'VE EVER","191":"SPAMMED IN","196":" ","200":"omg","203":"i am so","206":"good","211":"at this","217":"fkn game","219":"i see bugs","223":"fixedait!","227":"fixedamore","230":"beep beep","233":"abcdefghij","238":"i am lucky","240":"jimmy","243":"jeremy","244":"GO FOR GO","246":"GO FOR GO","251":"go for god","253":"winter","257":"winston","259":"marianna","264":"greg","269":"graeme","275":"abigirl","281":"kimberly","286":"patty","288":"tinnify","290":"breeding","295":"grae f","301":"bukake","305":"MR. KITE","308":"CHEE","310":"kittycake","312":"i win!","315":"osiris","320":"pedder","322":"Mnaeonic","327":"watadivvy","332":"Nathan","338":"Dave","343":"Mark","349":"chee","353":"superman","358":"KERRYBITCH","360":"jesus","366":"tedikringl","369":"Jonathanc","374":"stephorse","376":"stephorse","381":"Chickens","383":"luckychars","385":"cute cakes","388":"cute cakes","393":"kissyface","397":"<3","401":"hello","406":"mark","409":"jacqui","413":"jacqui","417":"BadAttitue","420":"This","422":"is","425":"shit","431":"shit","435":"..","438":"JJ","442":"scodger","447":"`","452":"robbie","456":"john","459":"chee","464":"TomBranton","469":"sh","473":"shehara","475":"shehara","479":"shehararar","485":"coolguy101","487":"felipe","489":"Adlai","493":"Adlai","497":"freiksenet","501":"freiksenet","507":"freiksenet","509":"freiksent","511":"Felipe","515":"РРВФЫВЫФВФ","520":"russianfnt","525":"вфывфыывыф","527":"выфвфвывф","528":"chee","530":"-","532":":(","537":"</3","541":"russians","546":"i hate","547":"russians","550":"i hate","553":"russians","558":"i hate","560":"firefox","563":"safari","565":"opera","566":"i like opa","567":"hoodeehoo","570":"THIS YAcht","574":"IDENTIFY","579":"you win","581":"no","585":"Me!","591":"I win\\","595":"Dophia","598":"God","601":"lol","605":"abberdale","606":"boringame","610":"marlboro","614":"nathan","619":"Boo!!!","622":"EyesTop","625":"between","627":"Mine","632":"sean koger","634":"eatgerms!!","638":"Namw","641":"yay","644":"okay","647":"i expect","649":"it works","657":"hooray","666":"wat","673":"wat","675":"hallo","690":"here is it","693":"graeme","704":"chee","717":"™§™•£™ª£ºº","729":"☭","735":"a boss","758":"better","780":"be","797":"could","803":"css","818":"the","829":"chee","842":"hello","865":"yay","881":"Graeme","897":"hello","908":"Graeme","923":"gaem","945":"nathan","967":"abigail","980":"ggg","995":"g","999":"g","1014":"g","1025":"g","1045":"g","1057":"o","1061":"heab","1075":"heab","1094":"heab","1095":"ok","1106":"ago","1121":"ege","1136":"™§™","1138":"hey","1147":"abigail","1166":"twotw","1190":"hehe","1209":"whah","1213":"whahatheh","1225":"356356","1244":"3562356","1260":"3562356","1264":"3562356","1273":"e","1282":"e","1295":"e","1311":"agsg","1320":"afgsg","1334":"hello","1336":"fix","1340":"yay","1352":"ok","1374":"abgail","1375":"?","1394":"hello","1397":"one","1399":"two","1411":"three","1433":"fou","1456":"hello","1465":"hi","1476":"okay","1492":"hooray","1504":"lol irony","1514":"mmkiyj","1527":"tjdjdt","1534":"tjdjdt","1545":"tjdjdt","1554":"what","1560":"the","1583":"fuck","1591":"is","1615":"is","1638":"is","1651":"wf","1674":"ok","1688":"geg","1695":"sna","1715":"gwgrngnaen","1722":"eagaehaeta","1734":"dfbdfbdfbb","1743":"geg","1745":"geg","1764":"hey","1767":"what","1772":"weeeoooLOL","1775":"171","1799":"261","1808":"ho","1818":"8","1840":"10","1851":"wha","1853":"graeme","1871":"graeme","1884":"eah","1908":"gg","1915":"abc","1921":"avc","1934":"avc","1936":"abc","1950":"ok","1970":"ge","1991":"shs","2003":"thd","2012":"234","2031":"abcdefgh","2034":"oen","2051":"rg","2060":"abc","2079":"helo","2093":"eaheh","2097":"g","2114":"aga","2118":"ag","2121":"aga","2140":"aga","2143":"aga","2148":"sg","2153":"aga","2166":"ag","2187":"123","2202":"1234","2206":"ge","2212":"aeg","2230":"hello","2251":"hey","2256":"graeme","2262":"peter","2278":"abigail","2299":"abc","2300":"i fell","2324":"a","2342":"b","2357":"c","2372":"d","2392":"e","2394":"f","2404":"f","2427":"f","2441":"f","2449":"f","2450":"f","2455":"f","2476":"f","2487":"f","2501":"f","2507":"wha","2519":"whah","2530":"abcb","2540":"geth","2559":"ethaeth","2575":"ethaeht","2590":"egah","2599":"ok","2622":"i win","2632":"ok","2656":"ok","2666":"ok","2687":"aba","2695":"aba","2699":"nathan","2719":"peter","2737":"jim","2752":"joe","2771":"adam","2772":"mark","2781":"one","2787":"two","2790":"three","2795":"4","2805":"5","2823":"1","2836":"2","2845":"3","2863":"4","2883":"5","2891":"1","2905":"2","2911":"3","2927":"4","2942":"5","2964":"1","2974":"abc","2989":"2","2992":"3","3004":"4","3021":"5","3030":"1","3036":"2","3045":"3","3066":"1","3077":"5","3092":"4","3111":"a","3124":"b","3147":"1","3149":"2","3150":"3","3164":"4","3166":"5","3190":"6","3196":"7","3210":"8","3212":"9","3217":"10","3231":"wefe","3236":"agaga","3241":"fvfv","3257":"avav","3267":"fe","3273":"ab","3276":"wfw","3282":"gf","3304":"aba","3318":"ha","3321":"ok","3326":"hello","3340":"why twice","3362":"ok","3372":"hello","3391":"refresh","3394":"go","3399":"gogogo","3405":"ok","3417":"hello","3429":"egge","3453":"hello","3460":"ok","3484":"ok","3488":"wgeg","3508":"egeg","3526":"hello","3540":"gege","3551":"awgwagaw","3552":"wgw","3563":"ggg","3576":"e","3585":"acb","3592":"ok","3609":"ok","3623":"hello","3646":"ahahaha","3666":"hooray","3669":"it works","3692":"it works","3700":"aegag","3708":"1234","3714":"OKOK","3725":"hello","3729":"ho","3746":"go","3754":"surprise","3769":"hello","3788":"fuck","3794":"lol","3818":"hm","3826":"4","3834":"1","3856":"2","3860":"3","3878":"6","3881":"1","3902":"2","3908":"4","3920":"5","3938":"6","3949":"7","3955":"9","3957":"10","3981":"1","4005":"2","4020":"3","4023":"4","4031":"5","4042":"6","4064":"7","4084":"8","4091":"9","4111":"10","4119":"123","4127":"hello","4136":"a","4158":"1","4180":"2","4200":"13","4223":"1","4246":"2","4257":"3","4272":"4","4292":"hello","4312":"hallo","4319":"!!!","4333":"hello","4340":"one","4361":"two","4364":"seven","4366":"hello","4387":"!!!","4410":"1234","4426":"1234","4445":"4321","4460":"hello","4482":"ok","4483":"hahaha","4504":"WHAT","4526":"WHAT","4534":"SNOOO","4535":"NOON","4538":"KOKOK","4551":"ok","4557":"ok","4571":"elleah","4584":"132","4590":"1","4605":"2","4621":"3","4636":"4","4642":"9","4653":"9","4664":"8","4668":"7","4671":"6","4689":"5","4692":"4","4707":"3","4711":"2","4714":"1","4725":"peter","4745":"rabbits","4750":"bleep","4751":"apple","4764":"hello","4788":"gegege","4811":"ahaha","4830":"pk","4852":"ok","4870":"ok","4887":"what","4895":"!!!","4908":"!!!","4927":"!!!","4934":"!!!","4939":"???","4958":"!!!!","4964":"a","4987":"a","4989":"b","4996":"c","4997":"d","5010":"e","5031":"f","5046":"g","5051":"h","5072":"i","5095":"j","5114":"k","5138":"l","5140":"m","5143":"n","5163":"o","5174":"p","5193":"q","5209":"r","5227":"s","5229":"t","5251":"u","5275":"v","5290":"w","5297":"x","5309":"y","5316":"z","5337":"!#$!#$","5360":"ok","5367":"ok","5369":"what","5387":"o","5405":"ok","5418":"quah","5421":"ok","5441":"horoay","5450":"14","5455":"16","5472":"hello","5481":"what","5482":"what","5501":"what","5520":"gg","5544":"gggg","5559":"what","5575":"hello","5578":"what","5590":"whathwha","5605":"huh","5629":"lol","5650":"huh","5667":"lol","5689":"hello","5696":"wtf","5701":"wtf","5708":"hey there","5717":"1","5727":"2","5751":"3","5756":"4","5774":"5","5783":"6","5794":"heha","5811":"lol","5820":"okk","5827":"ok","5830":"what","5835":"what","5849":"what","5851":"thanks","5852":"1","5865":"1","5889":"2","5909":"3","5919":"1","5936":"---------","5944":"1","5959":"g","5964":"wgwg","5968":"g","5970":"q","5971":"g","5981":"wgwg","6001":"what","6025":"ok","6028":"pl","6040":"oo","6048":"gege","6051":"eh","6072":"eah","6076":"t","6088":"fwfw","6105":"wgw","6119":"o","6127":"hehe","6130":"ok","6154":"ok","6175":"first","6192":"second","6195":"third","6198":"fourth","6209":"fifth","6227":"sixth","6236":"seventh","6238":"eighth","6262":"ninth","6279":"tenth","6282":"eleventh","6301":"nathan","6318":"peter","6324":"abigail","6334":"graeme","6335":"zero_cool","6341":"FILEZAP","6361":"CUNT FLAP"}
{"1":"zero_cool","2":"abigail","3":"abbie","5":"aby","7":"abby","9":"abbey","13":"aby","21":"abbie","35":"abigail","44":"oi","60":"hooray","72":"zeroO_Cool"}

0 comments on commit fa59c42

Please sign in to comment.