Skip to content

Instantly share code, notes, and snippets.

View carimura's full-sized avatar

Chad Arimura carimura

  • San Francisco, CA
View GitHub Profile
class S3Worker < IronWorker::Base
merge_gem 'aws'
attr_accessor :image_url, :aws_access, :aws_secret
File.open('~/image.jpg', 'wb') do |fo|
fo.write open(image_url).read
end
Aws::S3Interface.new(aws_access, aws_secret)
s3.put("mybucket", 'img.jpg', File.open('~/image.jpg'))
ENV['IRON_MQ_TOKEN'] = 'YOUR TOKEN'
ENV['IRON_MQ_PROJECT_ID'] = 'YOUR PROJECT ID'
tweets = Twitter.search("IronMQ")
ironmq = IronMQ::Client.new(
"token"=>ENV["IRON_MQ_TOKEN"],
"project_id"=>ENV["IRON_MQ_PROJECT_ID"],
"queue_name"=>"tweets"
)
tweets.map do |tweet|
ironmq.messages.post("#{tweet.id}")
tweets = Twitter.search("getiron")
ironmq = IronMQ::Client.new(
"token"=>ENV["IRON_MQ_TOKEN"],
"project_id"=>ENV["IRON_MQ_PROJECT_ID"],
"queue_name"=>"tweets"
)
tweets.map do |tweet|
ironmq.messages.post("#{tweet.id}")
tweets_array.each do |t|
Twitter.configure do |config|
config.consumer_key = "CONSUMER_KEY"
config.consumer_secret = "CONSUMER_SECRET"
config.oauth_token = "ACCESS_TOKEN"
config.oauth_token_secret = "ACCESS_SECRET"
end
output << Twitter.oembed(t.body.to_i).html
end
IronMQ::Client.new(:host => 'rackspace')
IronMQ::Client.new(:host => 'aws')
IronMQ::Client.new(:host => 'my_private_cloud')
@carimura
carimura / mailer.rb
Created June 11, 2012 19:25
app/models/mailer.rb
class Mailer < ActionMailer::Base
layout 'email'
default :from => "[email protected]"
def hello_world(email)
mail(:to => email,
:subject => "Hello World from IronWorker!")
end
end
@carimura
carimura / email.html.erb
Created June 11, 2012 19:27
app/views/layouts/email.html.erb
<!DOCTYPE html>
<html>
<head><title></title></head>
<body>
<%= yield %>
</body>
</html>
@carimura
carimura / hello_world.html.erb
Created June 11, 2012 19:28
app/views/mailer/hello_world.html.erb
Hello from Iron.io!
@carimura
carimura / iron_mailer.worker
Created June 11, 2012 19:36
workers/iron_mailer.worker
runtime "ruby"
# Naming our worker (this is an arbitrary string, we like camelcasing)
name "IronMailer"
# The actual worker file to execute
exec "iron_mailer.rb"
# Merging all of our Rails apps models
dir '../app/models'