5 ms·
Show HN: GitBattle – Battle two Github accounts
- bilalq 14y agoIt's definitely fun to mess around with. Nicely, done! Quick question: why do repo and gist counts cap at 100? I haven't looked at Github's API myself yet, so there might be a technical limitation here that I'm unaware of.
- jessepollak 14y agoYeah, there are a lot of technical limitations that we had to work around. Mainly, everything is paginated with a max per_page of 100. We decided to only analyze the 100 most recent gists and repos to not have to worry about that. For commits, however, we couldn't not analyze them, so we do a ton of processing. Basically, we loop over every one of your repos and loop over all of the pages of commits for that repo. For big repos (i.e. Facebook), that means we end up doing 100s of async API requests...it gets pretty intense.
- bilalq 14y agoIt makes sense that you're analyzing only the first 100, but it would probably be cool to add the raw quantities of these things as a metric. Perhaps they shouldn't count towards the score, but it would be cool to display them, and the info's readily available from https://api.github.com/users/:uname https://api.github.com/users/:uname
- icefox 14y agoWhat is it doing while "processing"? A progress bar would be a good idea.
- jessepollak 14y agoI said it below, but the big chunk of "processing" is looking at all of the commits for all of your repos. There's no good way to access this data, so we essentially loop over all of your repos and than for each repo loop over all the pages of commits--a lot of API requests.
- anigbrowl 14y agoUnlocking the secret of life, apparently. At least, that's what it says it's doing now, after complaining that nobody else had got this far. It's been about 5 minutes... ...maybe it would have been wise to start with a table of existing entries that could be resolved quickly. I don't use Git and couldn't think of any accounts off the top of my head, so I just set 'abc' against 'xyz' on the theory that those usernames were likely to exist. UPDATE: I'm getting the behavior with Obama v Romney and indeed Jesse P v Remy G. Maybe the server's just overloaded...
- jessepollak 14y agoHmmm...it shouldn't be taking that long? Would you mind checking your console?
- anigbrowl 14y agoSure: Failed to load resource https://platform.twitter.com/widgets.js Port error: Could not establish connection. Receiving end does not exist. miscellaneous_bindings:236 chromeHidden.Port.dispatchOnDisconnect miscellaneous_bindings:236 Uncaught ReferenceError: twttr is not defined app.js:190 ¯\(°_o)/¯
- jessepollak 14y ago:/ twitter's javascript api seems to have broken...weird. refresh and try again?
- anigbrowl 14y agoMaybe it's me...I have adblock, Ghstery, and Disconnect running.
- cbsmith 14y agoLooks like everyone else has discovered this too. I'm getting back messages that I've discovered the secret of life and still no results...
- jessepollak 14y agoare there still repos left under the processing box? if so, would you mind checking your console?
- tjdetwiler 14y agoUncaught ReferenceError: twttr is not defined EDIT: My cookie-blocking plugin apparently was blocking something critical.
- nitrogen 14y agoAlso got the same error due to the Twitter button not loading. It might be a good idea to handle that case in the code.
- jessepollak 14y agoshould be handled now, sorry about that!
- cbsmith 14y agoSorry, failed to follow up on this. It does work well now.
- brennenHN 14y agoThis is awesome!
- lefthansolo 14y agodoes nothing for me in ff 17/win
- arkenflame 14y agoI would love it if there were URLs that I could send to friends to show battle results.
- jessepollak 14y agoadded: http://gitbattle.com?u1=facebook&u2=twitter http://gitbattle.com?u1=facebook&u2=twitter
- akent 14y agoMaybe it would be "exactly what it sounds like" if it was instead called "GitHubBattle". Git != GitHub
- aristidb 14y agoIt seems like it overvalues Gists a bit. :)
- jessepollak 14y agoIt actually only values them as 5% of your score...despite their prominence :P
- zobzu 14y agoI dont like tweeter and I want to copy the link to the results easily. Doesn't seems possible. Bleh ;-)
- jessepollak 14y agoJust added that functionality: http://www.gitbattle.com/?u1=switz&u2=wetmore http://www.gitbattle.com/?u1=switz&u2=wetmore
- mion 14y agoNot sure if it can handle big repos very well, I just threw in Twitter vs Facebook for fun and I got stuck with the "secret of life" message. But it's pretty neat! :)
- jessepollak 14y agoYeah, we loop over every page of commits for every repo for each user, so it takes a little while...that being said, if you wait it's pretty cool to see. Twitter is ~90 and Facebook is ~80. I reached out to Github to see if there was a better way to do this, but they said there wasn't, unfortunately.
- RichardButler 14y agoTry Twitter vs Mozilla it's a fun one...
- Cogito 14y agoFor the lazy: http://gitbattle.com?u1=twitter&u2=mozilla http://gitbattle.com?u1=twitter&u2=mozilla
- ilovekhym 14y agoregarding the twitter vs facebook issue, checking the network panel on chrome, the rest of the request are pending and checking one of the requested url (https://api.github.com/repos/twitter/twitter4j/commits https://api.github.com/repos/twitter/twitter4j/commits) the error message is: { "message": "API Rate Limit Exceeded for 112.199.99.5" }
- jessepollak 14y agoIn the code, if you look, I actually extend that rate limit to 5000 by using authenticated requests (on the client side, I know, this is "dangerous"). The problem is that it just takes a long long time, lots of request (~400 for Facebook alone), which gradually slow down as the browser gets overloaded.
- devniel 14y agoSo funny
- Cogito 14y agoIf this is failing for you, make sure you haven't blocked twitter using Ghostery or the like, as this causes the script to error out. Uncaught ReferenceError: twttr is not defined app.js:196 setupWinner app.js:196 Maybe the script can be made a bit more robust in this case?
- jessepollak 14y agoGood idea! Added a check to see if twttr is defined, if it isn't I just don't add the share through twitter button. Thanks!
- Cogito 14y agoNo worries :) I should have opened a pull request for you! Awesome to see the quick turn around on your repo, though I haven't seen it deployed yet. It looks like you are using Heroku to deploy, have you not deployed yet or do I need to refresh my client-side resources?
- jessepollak 14y agoMade a little mistake, sorry, should be deployed in 10 seconds.
- Cogito 14y agoHa, no need to apologise! The fix works great.
- devin 14y agoI think you should weight the number of stars per repo higher. I think I am winning on number of repos and number of gists, but I think the user I'm battling beat me. Quality > Quantity.
- AngryParsley 14y agoThanks for this. I ran into a lucky coincidence: my GitHub account is exactly 1000 days old. It's surprising that I've been using GitHub for almost 10% of my life. (I'm 10,095 days old, so it'll be exactly 10% the week after next.)
- zdw 14y agoWell, this makes my devops decisions no easier as it's pretty much a dead heat: http://www.gitbattle.com/?u1=puppetlabs&u2=opscode http://www.gitbattle.com/?u1=puppetlabs&u2=opscode (incidentally, there appears to be a UI bug where it lists some repos multiple times - at the end the list looked like puppet/chef/puppet/chef/puppet/chef )
- Toshio 14y agoI've been thinking about a similar hack for awhile, but my idea was to measure/compare code cleanliness (in the agile sense of the word) and expressiveness between two chunks of code written by two different developers, in the same programming language and with the same number of SLOC. I believe something like this to be a much more reliable metric of code quality than commits per day and what have you. If someone else has already done this, I'd be fascinated to take a look at how you measure those things. The problem would require a non-trivial amount of AI.
- KMcHugh 14y agoNeat! It'd be really cool to see the top-scorer in an organization. Trying to compute the score of tobytripp (a coworker) leaves me at the secret of life with both "Error in event handler for 'undefined': Cannot read property 'qrstr' of undefined TypeError: Cannot read property 'qrstr' of undefined " and "Uncaught SyntaxError: Unexpected token ILLEGAL" in my console.
- jessepollak 14y agoAny idea what line numbers those came on? I'll try and fix it!
- KMcHugh 14y agoThe event_handler is in event_bindings:369, and the unexpected token is in line 711 of the api response, apparently? bit.ly/Tt9exN