Skip to content

Instantly share code, notes, and snippets.

@ckhrysze
Created July 1, 2010 20:39
Show Gist options
  • Save ckhrysze/460531 to your computer and use it in GitHub Desktop.
Save ckhrysze/460531 to your computer and use it in GitHub Desktop.
def url_available?(url_str)
url = URI.parse(url_str)
Net::HTTP.start(url.host, url.port) do |http|
return http.head(url.request_uri).code == "200"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment