Skip to content

Instantly share code, notes, and snippets.

@j4p3
Created December 5, 2018 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j4p3/6207788e572b90bef46db4c6a4ab8f6c to your computer and use it in GitHub Desktop.
Save j4p3/6207788e572b90bef46db4c6a4ab8f6c to your computer and use it in GitHub Desktop.
def is_big(url)
puts "checking if #{url} is big"
conn = Faraday.new(url: url)
res = conn.get
Integer(res.headers["content-length"])/1024 > 5000
end
Warehouse.all.map { |w| w.background_image_url }.compact.select { |u| is_big(u) }.size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment