Created
July 2, 2015 05:21
-
-
Save alexbaldwin/b5c21e281c590e9b8397 to your computer and use it in GitHub Desktop.
Soundcloud feed with HN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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