

Show HN: GitBattle – Battle two Github accounts - jessepollak
http://www.gitbattle.com

======
akent
Maybe it would be "exactly what it sounds like" if it was instead called
"GitHubBattle". Git != GitHub

------
zdw
Well, 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
I'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.

------
Cogito
If 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
Good 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
No 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
Made a little mistake, sorry, should be deployed in 10 seconds.

~~~
Cogito
Ha, no need to apologise! The fix works great.

------
AngryParsley
Thanks 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.)

------
devin
I 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.

------
cbsmith
Looks 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
are there still repos left under the processing box? if so, would you mind
checking your console?

~~~
tjdetwiler
Uncaught ReferenceError: twttr is not defined

EDIT: My cookie-blocking plugin apparently was blocking something critical.

~~~
nitrogen
Also 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
should be handled now, sorry about that!

------
KMcHugh
Neat! 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
Any idea what line numbers those came on? I'll try and fix it!

~~~
KMcHugh
The event_handler is in event_bindings:369, and the unexpected token is in
line 711 of the api response, apparently? bit.ly/Tt9exN

------
aristidb
It seems like it overvalues Gists a bit. :)

~~~
jessepollak
It actually only values them as 5% of your score...despite their prominence :P

------
arkenflame
I would love it if there were URLs that I could send to friends to show battle
results.

~~~
jessepollak
added:
[http://gitbattle.com?u1=facebook&u2=twitter](http://gitbattle.com?u1=facebook&u2=twitter)

------
bilalq
It'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
Yeah, 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
It 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>

------
icefox
What is it doing while "processing"? A progress bar would be a good idea.

~~~
anigbrowl
Unlocking 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
Hmmm...it shouldn't be taking that long? Would you mind checking your console?

~~~
anigbrowl
Sure:

    
    
      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
:/ twitter's javascript api seems to have broken...weird. refresh and try
again?

~~~
anigbrowl
Maybe it's me...I have adblock, Ghstery, and Disconnect running.

------
mion
Not 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
Yeah, 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.

------
ilovekhym
regarding 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>)

the error message is:

{ "message": "API Rate Limit Exceeded for 112.199.99.5" }

~~~
jessepollak
In 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.

------
RichardButler
Try Twitter vs Mozilla it's a fun one...

~~~
Cogito
For the lazy:

[http://gitbattle.com?u1=twitter&u2=mozilla](http://gitbattle.com?u1=twitter&u2=mozilla)

------
zobzu
I dont like tweeter and I want to copy the link to the results easily. Doesn't
seems possible. Bleh ;-)

~~~
jessepollak
Just added that functionality:
[http://www.gitbattle.com/?u1=switz&u2=wetmore](http://www.gitbattle.com/?u1=switz&u2=wetmore)

------
brennenHN
This is awesome!

------
lefthansolo
does nothing for me in ff 17/win

------
devniel
So funny

