Skip to content

Instantly share code, notes, and snippets.

Last active Oct 3, 2020
What would you like to do?
A really simple command-line Ruby application, for
FROM ruby
RUN mkdir /app
COPY Gemfile Gemfile
RUN bundle install
COPY google.rb google.rb
RUN chmod +x google.rb
ENTRYPOINT ["./google.rb"]
CMD ["docker"]
source ''
gem 'nokogiri'
#!/usr/bin/env ruby
require 'cgi'
require 'nokogiri'
require 'open-uri'
query = ARGV[0]
html = open("{CGI.escape(query)}") { |io|
results = html.css('.g')
results.each do |result|
header = result.at_css('h3')
puts header.text if header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment