Skip to content

Instantly share code, notes, and snippets.

@jmoon90
Last active December 28, 2015 12:49
Show Gist options
  • Select an option

  • Save jmoon90/7503753 to your computer and use it in GitHub Desktop.

Select an option

Save jmoon90/7503753 to your computer and use it in GitHub Desktop.
Allows you to ask questions through your terminal and it will open up google and ask that question for you.
require 'uri'
class Browser
def initialize(question)
@question = question
end
def browse
system("open", url)
end
def url
("http://www.google.com/search?q=#{URI.escape(@question)}")
end
end
puts "What quesiton do you have?"
question = gets.chomp
browser = Browser.new(question)
browser.browse
@jmoon90
Copy link
Copy Markdown
Author

jmoon90 commented Nov 16, 2013

This script allows you to ask questions directly through the terminal. You run the script and type in your question. It opens up your main browser and asks the question in google.

I created an alias to 'google', so when I type google it runs my browser.rb script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment