Last active
June 26, 2022 03:52
-
-
Save henrik/daf6335032d768a8829d4c37cc17c793 to your computer and use it in GitHub Desktop.
Daring Fireball max time between posts/links: https://daringfireball.net/linked/2022/06/22/kottke-sabbatical
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
require "open-uri" | |
r = -> { URI(_1).read } | |
post_dates = r.("https://daringfireball.net/archive/") | |
.scan(%r{<small>(.+?)</small>}) | |
.map { |(x)| Date.parse(x.gsub(" ", " ")) } | |
link_dates = r.("https://daringfireball.net/linked/") | |
.scan(%r{href="(.+?/linked/20\d\d/.+?)"}) | |
.flat_map { |(x)| r.(x).scan(%r{<h2 class="dateline">(.+?)</h2>}).map { |(y)| Date.parse(y) } } | |
p (post_dates + link_dates).sort.uniq.each_cons(2).map { [ _1.to_s, _2.to_s, (_2 - _1).to_i ] }.max_by(&:last) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment