Skip to content

Instantly share code, notes, and snippets.

@zamith
Created April 29, 2013 11:12
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 zamith/5480996 to your computer and use it in GitHub Desktop.
Save zamith/5480996 to your computer and use it in GitHub Desktop.
def track_event_on_mixpanel
Resque.enqueue MixpanelTrackEventJob, "Event", properties, env
end
class MixpanelTrackEventJob
@queue = :slow
def self.mixpanel env
Mixpanel::Tracker.new MIXPANEL_TOKEN, { :env => env }
end
def self.perform name, properties, env
mixpanel(env).track name, properties
end
end
rails_root = Rails.root
rails_env = Rails.env
resque_config = YAML.load_file(rails_root.to_s + '/config/resque.yml')
Resque.redis = resque_config[rails_env]
development: localhost:6379
production: localhost:6379
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment