Skip to content

Instantly share code, notes, and snippets.

@dzwillpower
Forked from henrik/gist_search.rb
Created July 9, 2013 03:03
Show Gist options
  • Save dzwillpower/5954362 to your computer and use it in GitHub Desktop.
Save dzwillpower/5954362 to your computer and use it in GitHub Desktop.
require "open-uri"
require "rubygems"
require "json"
USERNAME = "henrik"
query = ARGV.first.downcase
gists = JSON.parse(open("http://gist.github.com/api/v1/json/gists/#{USERNAME}").read)['gists']
gists.each do |gist|
files = "(%s)" % gist['files'].join(', ')
description = gist['description']
unless description.to_s.downcase.include?(query) || files.downcase.include?(query)
next
end
puts description if description
puts files
puts "https://gist.github.com/gists/#{gist['repo']}"
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment