Skip to content

Instantly share code, notes, and snippets.

@mattmanning
Created April 27, 2011 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattmanning/945051 to your computer and use it in GitHub Desktop.
Save mattmanning/945051 to your computer and use it in GitHub Desktop.
require 'addressable/uri'
def remove_query_param(url, param)
uri = Addressable::URI.parse(url)
params = uri.query_values
params.delete(param)
uri.query_values = params
uri.to_s
end
puts remove_query_param('http://search.twitter.com/search.json?&q=twitter&since_id=1520639490&geocode=40.757929%2C-73.985506%2C25km','since_id')
# => http://search.twitter.com/search.json?geocode=40.757929%2C-73.985506%2C25km&q=twitter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment