Created
June 28, 2011 04:06
-
-
Save saterus/1050467 to your computer and use it in GitHub Desktop.
Subreddit Categorization
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
#!/bin/env ruby | |
have_ap = require 'awesome_print' | |
if have_ap | |
def fancy_print(s) | |
ap s | |
end | |
else | |
def fancy_print(s) | |
ap s | |
end | |
end | |
path = ARGV.shift | |
lines = File.readlines(path) | |
lines.map(&:strip!) | |
categories = test = Hash.new{|h, k| h[k] = []} | |
lines.map do |r| | |
fancy_print categories | |
puts("#{r}: (#{categories.keys})") | |
i = gets | |
i.strip! | |
categories[i.intern] << r | |
end | |
fancy_print categories |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment