Created
July 3, 2015 10:03
-
-
Save beck03076/fd1791bab2efdd2dbf62 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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