Skip to content

Instantly share code, notes, and snippets.

@alexbaldwin
Created July 2, 2015 05:21
Show Gist options
  • Save alexbaldwin/b5c21e281c590e9b8397 to your computer and use it in GitHub Desktop.
Save alexbaldwin/b5c21e281c590e9b8397 to your computer and use it in GitHub Desktop.
Soundcloud feed with HN
client.get('/me/activities').collection.each do |track|
favorites = track.origin['favoritings_count']
time_ago_in_hours = Time.diff(Time.now, Time.parse(track.created_at))[:hour]
score = (favorites / ((time_ago_in_hours + 2)**1.8)).ceil
p "#{track.origin['title']} - #{score}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment