Created
April 21, 2011 18:16
-
-
Save ktusznio/935156 to your computer and use it in GitHub Desktop.
Script to hash up the intl_users csv
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
def make_hash | |
f = File.new("/tmp/intl_users_with_name_and_email") | |
out = open("/tmp/intl_users_json", "w") | |
proxy_emails = 0 | |
blank_names = 0 | |
total = 0 | |
while (line = f.gets) | |
begin | |
id, name, email = line.split(",") | |
proxy_emails += 1 unless (email =~ /proxymail\.facebook\.com/).nil? | |
blank_names += 1 if name.blank? | |
total += 1 | |
json = {:id => id.strip, :name => name.strip, :email => email.strip}.to_json | |
out.puts json | |
rescue => e | |
puts "#{e.message} on #{line}" | |
end | |
end | |
puts "total #{total}" | |
puts "proxy emails: #{proxy_emails} (#{Float(proxy_emails) / Float(total)})" | |
puts "blank names: #{blank_names} (#{Float(blank_names) / Float(total)})" | |
f.close | |
out.close | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment