public
Last active

  • Download Gist
people.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
require 'twitter'
 
 
types = ['istj', 'estj', 'isfj', 'esfj', 'istp', 'estp', 'esfp', 'isfp', 'entj', 'entp', 'intp', 'enfj', 'infj', 'enfp', 'infp']
 
File.delete "people.html"
 
File.open("people.html", "w") do |f|
 
f << %Q{
 
<html>
<head>
<title>People</title>
</head>
<body>
<h1>Personality types by twitter profile picture</h1>
}
 
seen = []
 
types.each do |type|
f << %Q{<h2><a href="http://www.personalitypage.com/#{type.upcase}.html">#{type}</a></h2>}
 
tweets = Twitter::Search.new(type).per_page(50).fetch.results
 
tweets.each do |tweet|
next if tweet.profile_image_url == "http://static.twitter.com/images/default_profile_normal.png"
next if seen.include?(tweet.from_user_id)
seen << tweet.from_user_id
f << %Q{<a href="http://twitter.com/#{tweet.from_user}"> <img width=48px src="#{tweet.profile_image_url}" /></a>}
end
 
end
 
f << "</body></html>"
 
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.