Created
February 28, 2014 14:44
-
-
Save subelsky/9272335 to your computer and use it in GitHub Desktop.
How I generate the list of links for https://tinyletter.com/subelsky
This file contains 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
#!/usr/bin/env ruby | |
require "rubygems" | |
require "mechanize" | |
require "domain_name" | |
m = Mechanize.new | |
puts "<ul>" | |
DATA.each_line do |line| | |
link = line.chomp | |
title = m.get(link).title.to_s.chomp rescue StandardError | |
title ||= link # in case we can't get a title, fall back to link | |
domain = DomainName(URI.parse(link).host).domain | |
title.gsub!(/\s+/," ") | |
puts "<li><a href='#{link}'><em>#{title}</em> (#{domain})</a></li>\n" | |
end | |
puts "</ul>" | |
__END__ | |
http://hypem.com/popular/noremix | |
http://batsov.com/articles/2014/02/17/the-elements-of-style-in-ruby-number-13-length-vs-size-vs-count/ | |
https://medium.com/medium-long/4c59524d650d | |
https://medium.com/show-your-work/7fb5fdfbc068 | |
http://blogs.hbr.org/2014/02/new-research-a-supportive-culture-buffers-women-from-the-negative-effects-of-long-hours | |
http://robots.thoughtbot.com/avoid-the-threestate-boolean-problem | |
http://robots.thoughtbot.com/if-you-gaze-into-nil-nil-gazes-also-into-you | |
https://crackstation.net/hashing-security.htm | |
https://www.imperialviolet.org/2014/02/22/applebug.html | |
http://blog.42floors.com/thirty-percent-feedback/ | |
http://viget.com/extend/make-remote-files-local-with-ruby-tempfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment