Skip to content

Instantly share code, notes, and snippets.

@henrik
Last active June 26, 2022 03:52
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henrik/daf6335032d768a8829d4c37cc17c793 to your computer and use it in GitHub Desktop.
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
require "open-uri"
r = -> { URI(_1).read }
post_dates = r.("https://daringfireball.net/archive/")
.scan(%r{<small>(.+?)</small>})
.map { |(x)| Date.parse(x.gsub("&nbsp;", " ")) }
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