Skip to content

Instantly share code, notes, and snippets.

@passcod
Created Sep 27, 2012
Embed
What would you like to do?
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