Skip to content

Instantly share code, notes, and snippets.

@beck03076
Created July 3, 2015 10:03
Show Gist options
  • Save beck03076/fd1791bab2efdd2dbf62 to your computer and use it in GitHub Desktop.
Save beck03076/fd1791bab2efdd2dbf62 to your computer and use it in GitHub Desktop.
def check_image(url)
uri = URI(url)
request = Net::HTTP.new uri.host
response= request.request_head uri.path
return response.code.to_i == 200
end
@count = 0
Image.all.each do |i|
str = i.original
if str.include?('dpjnlniaq')
@success = []
@fail = []
puts "------ #{str} --------"
newstr = str.gsub(/dpjnlniaq/,'shopo')
puts "------New-----#{newstr}---------"
puts "#### Now at #{@count} #################"
if check_image(newstr)
@success << i.id
else
@fail << i.id
end
@count += 1
else
puts "**** Not menthols cloud******"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment