Show HN: Lateral thinking riddles site
riddledribble.com1 pointsby amikazmi1 comments
def fresh_commits(repo, n = 10)
commits = repo.heads.map do |h|
repo.commits(h.name, n).map { |c| Commit.new(c, h) }
end
commits.flatten.uniq_by(&:id).sort_by(&:committed_date).first(n)
end
Do you agree that the last line is clean & readable, even if you don't know "exactly" what "&:function_name" does?
One thing that looks a bit off is that part of the physics engine runs in reverse -
When a piece touch the high part of a pile, the sand is going UP from the bottom of the valley to the top, instead of from the top DOWN to the bottom
When the process finishes the end result is the same, it's just a bit strange :)
Example in https://youtu.be/Hp4nV4EjLgM?t=133