Skip to content

Instantly share code, notes, and snippets.

View pablomarti's full-sized avatar
🧙‍♂️
💻

Pablo Martí pablomarti

🧙‍♂️
💻
View GitHub Profile
@pablomarti
pablomarti / example_activejob.rb
Created May 3, 2016 01:25 — forked from ChuckJHardy/example_activejob.rb
Example ActiveJob with RSpec Tests
class MyJob < ActiveJob::Base
queue_as :urgent
rescue_from(NoResultsError) do
retry_job wait: 5.minutes, queue: :default
end
def perform(*args)
MyService.call(*args)
end

I use this Capistrano task so I don't have manually do git push before cap deploy. It includes some error checking to make sure I'm on the right branch (master) and haven't got any uncommitted changes.

Simply add the code below to config/deploy.rb, then run cap deploy:push to test, and cap deploy to deploy as usual.

@pablomarti
pablomarti / engine.rb
Created March 26, 2013 04:21
Use OmniAuth middleware with Facebook inside of an engine. Example: https://github.com/pablomarti/simple_user/blob/master/lib/simple_user/engine.rb
module SimpleUser
require 'rubygems'
require 'omniauth'
require 'omniauth-facebook'
class Engine < ::Rails::Engine
isolate_namespace SimpleUser
middleware.use OmniAuth::Builder do