Skip to content

Instantly share code, notes, and snippets.

@dotspencer
Created June 7, 2016 22:08
Show Gist options
  • Save dotspencer/e7e9d6a51ad0146ed57155c4e1844c6b to your computer and use it in GitHub Desktop.
Save dotspencer/e7e9d6a51ad0146ed57155c4e1844c6b to your computer and use it in GitHub Desktop.
First Ruby tool
require 'sinatra'
require 'open-uri'
def staff
url = "https://egi.utah.edu/about/staff/?mode=quick"
text = URI.parse(url).read
output = ""
text.each_line do |line|
if line.include? "class=\"staff\">"
cleaning = line.split("class=\"staff\"\>")[1]
result = cleaning.split("<br/>")[0]
output += "<li>#{result}</li> "
end
end
return output
end
get '/' do
"<link href='style.css' rel='stylesheet' type='text/css'>" +
"<a href='staff'>View Staff</a>"
end
get '/staff' do
"<link href='style.css' rel='stylesheet' type='text/css'>" +
staff
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment