Created
September 27, 2012 10:20
-
-
Save passcod/3793320 to your computer and use it in GitHub Desktop.
Sample onthesides job
This file contains 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
# Fetch a list of words to search | |
# for on Twitter, and return the | |
# last ~10 people who used each. | |
# There's a bunch of libraries you | |
# can use. E.g. typhoeus for HTTP. | |
url = "https://raw.github.com/gist/123456" | |
watch = Typhoeus::Request.get url | |
# YAML, JSON, Nokogiri for XML, Base64... | |
list = YAML.load(watch.body).map do |word| | |
res = { search: word, results: [] } | |
# Various 3rd party APIs, like Twitter, | |
# Facebook, GitHub, Foursquare... | |
Twitter.search( | |
word, | |
count: 10, | |
result_type: "recent" | |
).results.map do |status| | |
res[:results].push status.from_user | |
end | |
res[:results].uniq! | |
res | |
end | |
# on the sides also has an API, which | |
# you can use for logging data, or | |
# even creating new jobs from within! | |
Sides.log list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment