Skip to content

Instantly share code, notes, and snippets.

@passcod
Created September 27, 2012 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save passcod/3793320 to your computer and use it in GitHub Desktop.
Save passcod/3793320 to your computer and use it in GitHub Desktop.
Sample onthesides job
# 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