Show HN: Code on Hacker News
code.hn
code.hn
<a href="https://github.com/montanaflynn/codehn" onclick="trackOutboundLink(this); return false;">(source code)</a>
Either the tracking thing or the `return false` is causing the click to not actually click. Let's be real: everyone on this site is blocking your tracking whatchamajig.Edit:
I added a check to make sure google analytics is not blocked, it should work for you now.
Thanks for letting me know.
Also, does it only show the github links or it also shows the gitlab links?
It shows links for both github and gitlab links.
Edit: I changed the logo and favicon from a Y to a C.
> the API leaves a lot to be desired
Yes, it does. We're going to make a new API that gives you a simple JSON version of any HN URL. Would that address any of the concerns you encountered?
Oh, that would be amazing. I wanted to do an analysis of top level, second level, etc comments, but I looked at the API and thought better of it.
The main problems I had were:
1. The stories endpoints were limited to 200 or 500 results, not paginated.
2. I had to loop over and send a request to all the individual stories to check if the url was from github or gitlab.
3. There was not an endpoint for "show new" (/shownew)
4. It was unclear from the docs what is shown on the website homepage (beststories or topstories?)
I use the HN API to get the stories and then filter out any none code stories. Next up I will add a filter for programming language so you can easily see all the latest projects in your preferred language.
The server is written in Golang and I used nginx with Let's Encrypt for a free SSL certificate.
Specifically I used https://certbot.eff.org with nginx.
One difference is that ?site=github.com seems to only work on the /from page so the results are not broken into top / new / best / show pages.
I'm also planning to add a filter so you can only see projects for your language of choice.