reorganized trunk directory

This commit is contained in:
jywarren
2010-02-25 16:16:58 -05:00
parent 9f03d0c76f
commit a0c5e9a8c9
3954 changed files with 1 additions and 28919 deletions

View File

@@ -0,0 +1,38 @@
class UtilityController < ApplicationController
def proxy
url = URI.parse(params[:url])
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
render :text => res.body
end
def geocode_sites
file = File.new("public/sites.txt", "r")
line = file.gets.chomp!
sites = []
while (line) # goes through names in file until it finds one that hasn't been used yet
begin
geo = GeoKit::GeoLoc.geocode(line)
rescue
end
if geo
sites << [line,geo.lat,geo.lng]
end
line = file.gets.chomp!
end
file.close
render :json => sites
end
def geocode
if params[:location]
@geo = GeoKit::GeoLoc.geocode(params[:location])
puts @geo.lat
render :json => @geo if params[:format] == 'json'
end
end
end