Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Google SERP Checker
require 'sinatra'
get '/rankypanky' do
"<form action='/ranked' method='post'>
<label for='keyword'>Keyword</label>
<textarea name='keyword' id='keyword' type='text' /></textarea>
<label for='url'>URL</label>
<input name='url' id='url' type='text' />
<input type='submit' value='Do the RankyPanky' />
##cannot separate list by space as user might never use a space
##cannot separate on comma as user might never use a comma
##cannot separate on newline as user might comma separate multiple kws on single line
##user may use spaces to specify keywords of more than one word in length
post '/ranked' do
if params[:url] != ''
url = params[:url] #line created so I can return url more easily (or, in general)
keywords = params[:keyword].gsub("\n", ",").delete("\r").split(",") #.delete redundant?
return "#{keywords}", "#{url}" #so that I can return url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment