Last active
December 28, 2015 12:49
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.