Skip to content

Instantly share code, notes, and snippets.

@kennethreitz
Forked from henrik/gist_search.rb
Created February 2, 2011 23:07
Show Gist options
  • Save kennethreitz/808649 to your computer and use it in GitHub Desktop.
Save kennethreitz/808649 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