Skip to content

Instantly share code, notes, and snippets.

@loganhasson
Created October 3, 2013 02:06
Show Gist options
  • Save loganhasson/6803589 to your computer and use it in GitHub Desktop.
Save loganhasson/6803589 to your computer and use it in GitHub Desktop.
reddit.formatting
while true
system("clear")
longest_upvote = 0
Post::POSTS.each do |post|
if post.upvotes.to_s.length > longest_upvote
longest_upvote = post.upvotes.to_s.length
end
end
Post::POSTS.each do |post|
puts post.id.red + ' ' + post.upvotes.to_s.center(longest_upvote, " ").green + ' ' + post.title[0..60].black
end
path = $stdin.gets.chomp
if path == 'exit'
break
else
Post.launch_story(path)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment