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 (gameDate > checkDate) { | |
| if (count <= 0 && data.HasMorePages) { | |
| callback(true); | |
| } | |
| else callback(false); | |
| } | |
| else callback(false); |
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
| function onData(page) { | |
| parseData(page, function(hasMore) { | |
| if ( | |
| pagePush = pages[0]+1 | |
| pages.push(pagePush) | |
| console.log('onData: '+pages[0]); | |
| getPage(pages.shift()); | |
| } | |
| else console.log('no more pages'); | |
| }); |
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
| {"reason":"Okay","status":0,"HasMorePages":true,"RecentGames":[{"CampaignDifficulty":"Easy","CampaignGlobalScore":0,"CampaignMetagameEnabled":false,"GameDuration":524,"GameId":231789949,"GameTimestamp":"\/Date(1287243066000-0700)\/","GameVariantClass":2,"GameVariantHash":-9102622298157329361,"GameVariantIconIndex":1,"GameVariantName":"Slayer DMRs","HasDetails":false,"IsTeamGame":true,"MapName":"Forge World","MapVariantHash":-5802700002034194303,"PlayerCount":8,"PlaylistName":"Team Arena (Season 2)","RequestedPlayerAssists":1,"RequestedPlayerDeaths":11,"RequestedPlayerKills":13,"RequestedPlayerRating":1308,"RequestedPlayerScore":38,"RequestedPlayerStanding":1} |
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
| function getGame(gameIds) { | |
| gameIds.some(function(gameId) { | |
| db.getDoc(gameId, function(er, doc) { | |
| //console.log('db.getDoc'); | |
| if (er) { | |
| //console.log('db.getDoc > er'); | |
| httpGet(url+gameId, function(data) { | |
| //console.log('db.getDoc > er > httpGet'); | |
| db.saveDoc(gameId, data, function(er, ok) { | |
| if (er) throw new Error(JSON.stringify(er)); |
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
| gamesWrite.saveDoc(gameId, { | |
| "players": { | |
| gamertag: [{ | |
| "rating": rating, | |
| "standing": standing | |
| }] | |
| } | |
| } |
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
| {"players": | |
| { | |
| "gamertag": [ //gamertag would be set inside the loop through a variable, like "chapel" or "awesome" | |
| { | |
| "rating": 1234, | |
| "standing": 1 | |
| } | |
| ], | |
| "chapel": [ | |
| { |
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
| function parseGame(page) { | |
| var players = page.GameDetails.Players, | |
| count = players.length, | |
| gameId = page.GameDetails.GameId, | |
| i = 0, | |
| req = 'http://couchdb:5984/games/'; | |
| data = {"players": []}; | |
| data.date = new Date(parseInt(page.GameDetails.GameTimestamp.substr(6))); | |
| console.log(count); | |
| //players.some(function(player) { |
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
| [{gamertag: "zSoloo", rating: 1387, standing: 4, curArenaDiv: 0, curArenaPer: 0, pastArenaDiv: 4, pastArenaPer: 30}, {gamertag: "NavalBOB", rating: 1654, standing: 0, curArenaDiv: 0, curArenaPer: 0, pastArenaDiv: 4, pastArenaPer: 30}, {gamertag: "iBRetaIiation", rating: 1470, standing: 2, curArenaDiv: 4, curArenaPer: 10, pastArenaDiv: 5, pastArenaPer: 30}, {gamertag: "K1PEASTW0OD", rating: 899, standing: 7, curArenaDiv: 0, curArenaPer: 0, pastArenaDiv: 3, pastArenaPer: 0}, {gamertag: "ILOVEZTRIP619", rating: 1474, standing: 1, curArenaDiv: 5, curArenaPer: 80, pastArenaDiv: 4, pastArenaPer: 30}, {gamertag: "wolFy caps", rating: 1372, standing: 5, curArenaDiv: 0, curArenaPer: 0, pastArenaDiv: 0, pastArenaPer: 0}, {gamertag: "SLOW MO JOE", rating: 1121, standing: 6, curArenaDiv: 0, curArenaPer: 0, pastArenaDiv: 0, pastArenaPer: 0}, {gamertag: "thechapel", rating: 1392, standing: 3, curArenaDiv: 2, curArenaPer: 0, pastArenaDiv: 2, pastArenaPer: 10}] |
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
| var oAuth = new OAuth('https://api.twitter.com/oauth/request_token', 'https://api.twitter.com/oauth/access_token', 'consumer', 'secret', '1.0A', null, 'HMAC-SHA1'); | |
| var twitterAccessToken = 'consumer', | |
| twitterAccessTokenSecret = 'secret'; | |
| oAuth.post('http://api.twitter.com/1/statuses/update.json', twitterAccessToken, | |
| twitterAccessTokenSecret, {"status":"Testing api"}, function(error, data) { | |
| if(error) console.log(error); | |
| else console.log(data); | |
| }); |
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( orderedParameters[i][0].match('^oauth_') == "oauth_") { | |
| authHeader+= this._encodeData(orderedParameters[i][0])+"=\""+ this._encodeData(orderedParameters[i][1])+"\","; | |
| console.log('true'); | |
| } |