Hacking and Gonzo

medium.com/hacking-and-gonzo · Group blog · on HN since 2015

Hacking and Gonzo is a Medium publication by a developer writing on ranking algorithms, Redis analytics and front-end design patterns.

What HN saysHN commenters mainly link its explainer on how the Hacker News ranking algorithm works, including when discussing moderator interventions and how HN-style ranking is reused.
30HN people shared it
25linked it in comments
7stories submitted
30story points
10 months agolast shared
2015people per year2026

Most-shared posts

  1. 1
    How Hacker News ranking algorithm works
    23 people · 28 points · first shared 2016 · 1 comments on HN
  2. 2
    How reddit ranking algorithms work ef111e33d0d9
    6 people · first shared 2017
  3. 3
  4. 4
    Flux vs. MVC (Design Patterns)
    1 people · 1 points · first shared 2016 · discussion on HN

What HN people wrote when they linked it

matt1 · 2022-12-09
Anyone can sign up and share example prompts, whether it's one they came up with or one they saw online (in which case they can give the source credit). The submissions are then ranked the exact same way HackerNews articles are ranked on the homepage, following this algorithm: https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm… - in short, it's based on how many votes the prompt has received and how long since it was posted.
cagriuysal · 2021-04-10
I was learning authentication with graphql and decided to put my knowledge into practice by cloning one of my favorite sites! First of all, I am sorry for not creating a demo server for this, I don't really know how to put full stack projects into production yet. That being said, I have dockerized the project for easy setup, if you have time you can check it out, I would appreciate that. What I would appreciate more is, giving me ideas about some hurdles I came across while implementing this. 1. It was somewhat difficult to create your own authentication system from scratch(although I walkthrough a youtube tutorial). Are you implementing your own system, or using a 3rd party? I heard `hasura` and `firebase` is also good alternative for authentication. 2. While using Prisma and GraphQL, I felt like, I was duplicating the schemas for both of them. Is there a way to combine them into a single place? 3. Implementing home page was difficult for me. I have assigned a `ranking` field for each `post` in database. This ranking field calculated as described in this link : https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm… I've only take into account submissions that created less than 2 days ago and updated rankings every 10 minute by a cron process. How would you architect this?
cbeach · 2024-03-22
I recognise the huge amounts of effort involved in this and I applaud the moderators for keeping HN an interesting place to be. That said, I think it's reasonable for us to have visibility on their manual interventions, and this could be easily surfaced via the Hacker News API (https://github.com/HackerNews/API), if the Story JSON included the values of "contro," "bury," and "gag" fields, which are currently opaque to users of the API See https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm… for more discussion on terminology One other positive thing to mention about HN: the cost of running HN is non-zero, yet it remains ad-free. I'm grateful for this. So many websites have become unusable due to monetisation dark patterns.
GaryNumanVevo · 2022-12-14
The frontpage ranking algorithm is pretty simple (and open source). It just takes into account post age + votes with an exponential falloff over time. It doesn't take into account comments, so going to news.ycombinator.com/active is probably where you'll see the more active threads. https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm…
jtxt · 2022-10-02
I really like this idea! Related results work fairly well. Tons of potential here! Ideas: Allow voting for prompts. Allow voting for results. (But try to prevent the rich get richer effect... https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm… Allow requesting more results for a given prompt. bug: When there is an error, make it so "back" goes to before the error, instead of before I went to the website perhaps?
elliottetzkorn · 2022-03-17
Fun fact I used a modified version of Paul Graham's own ranking algorithm for hacker news for this website! https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm…
robbomacrae · 2022-02-28
If i recall correctly the Hacker News ranking gives new items a bit of a boost... possibly more-so for some random users, in order to give them a chance at getting some traction. You might be able to find out more here: https://felx.me/2021/08/29/improving-the-hacker-news-ranking-algorithm… https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm…
sulam · 2022-01-24
Here you go, you can learn how the algorithm works yourself. https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm… Fair warning, it's written in Lisp.
NathanielK · 2021-02-09
Smaller subreddits are beings dead is partially due to reddit's Hot ranking algorithmn. It is designed to have fresh posts up top on the daily [1]. Unless you switch to an alternate rating scheme (monthly top is helpful), any subreddit without hundreds of posts per week is basically dead. Large subreddits with thousands of weekly posts have the opposite problem, where low effort posts will dominate the top if unmoderated. [1] https://medium.com/hacking-and-gonzo/how-reddit-ranking-algorithms-wor…
pwg · 2019-12-03
See: How Hacker News ranking algorithm works https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm… Posts get to the front page by being upvoted by users. The posts then decay off the front page as time goes by. So the mix that is there is based upon what users upvote. Therefore, if you want differing content on the front page, then start upvoting stuff sitting on the new page that you'd like to see on the front page to help it get to the front page.
wyattpeak · 2019-03-14
All sorting is algorithmic. Sorting by submission order is an algorithm. Regardless, we don't have to speculate since the site is open-source. You can see the sorting algorithm, and a breakdown of it, here[1]. It's just number of votes and time decay. [1] https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm…
hjek · 2018-11-09
Interesting. Does your ranking algorithm work like Reddit[0] or HN[1] or is it something different? [0]: https://medium.com/hacking-and-gonzo/how-reddit-ranking-algorithms-wor… [1]: https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm…
mujoco · 2018-09-24
It seems like they're doing something similar to how Reddit's "hot" algorithm reportedly works. As of 2015, that was supposedly like: log(upVotes - downVotes) - (hoursOld / 12.5), according to https://medium.com/hacking-and-gonzo/how-reddit-ranking-algorithms-wor… Fair Trending basically differs just in the log() part, substituting (fractionUpVotes * views) for (upVotes - downVotes). This could change the ranking if a lot of people view without voting either way.
erpellan · 2018-04-09
Don't modify the scores of old posts, start newer ones with a higher score. Check out how reddit does it: https://medium.com/hacking-and-gonzo/how-reddit-ranking-algorithms-wor… The concept is that the time-based part of the score is immutable, fixed at post creation time. That way you only have to recalculate when a score-modifying event occurs, not every time the page is refreshed.
HenriNext · 2017-09-22
Actually it's on both. The 'show' has recent top submissions, selected and sorted by ranking algorithm [1], and 'show new' has all recent submissions, sorted in reverse chronological order. [1] https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm…
amsilprotag · 2017-07-05
The first graph linked below shows "hotness" as a function of time with upvotes held constant. The equations are above the linked section. Compounding this effect, there is a feedback loop where hotter elements are more likely to be seen and voted, which increases hotness logarithmically. So no, the algorithm doesn't intentionally punish dense material. But it does happen incidentally. https://medium.com/hacking-and-gonzo/how-reddit-ranking-algorithms-wor…
saycheese · 2017-03-14
Anyone interested in the topic of HN's ranking algorithm should look through the HN's submission archives: https://hn.algolia.com/?query=How%20Hacker%20News%20ranking%20algorith… For example: https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm…
BayesStreet · 2017-02-10
Score = (P-1) / (T+2)^G where, P = points of an item (and -1 is to negate submitters vote) T = time since submission (in hours) G = Gravity, defaults to 1.8 in news.arc Edit: obsolete algorithm, find updated below. From https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm…
pkkim · 2017-02-09
Why is this on the third page when there are stories on the second page with fewer points and posted before this one? At least in December 2015, ranking was a function of those two things: https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm… Update: Page 4 as of a few minutes ago: http://imgur.com/a/M6XuC
eddd · 2016-04-16
How did you implement scoring system? Is it simple: select max(score) from casts where submit_time > NOW - 7days; or something more sophisticated https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm… ?
EGreg · 2017-03-08
Just out of curiosity, how do you crush a site with just posting maybe 100 text based comments on the top 20 items or whatever? I mean what exactly is the load that causes this? If you are executing some algorithm for each request - stop. Just run it every minute to rebuild a cache. HN discourages rapid fire replies anyway. How hard is it to simply build an html fragment from a tree and cache it? You just see what nodes need other nodes to be appended. OK, I can imagine MAYBE the most intensive thing is the votes and re-ordering of replies. First of all I hope you are using this algorithm: https://medium.com/hacking-and-gonzo/how-reddit-ranking-algorithms-wor… Secondly, seriously once again you can batch the upvotes by thread and then process them during the recalculation phase. You only need to recalculate weight totals for the threads where there were upvotes - and this can be parallelized.

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close