Skip to content

Instantly share code, notes, and snippets.

View rafaelgaspar's full-sized avatar

Rafael Gaspar rafaelgaspar

View GitHub Profile
@rafaelgaspar
rafaelgaspar / 0_reuse_code.js
Created December 19, 2016 12:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rafaelgaspar
rafaelgaspar / RESQUE_REMOVE_DUPLICATES.md
Last active March 22, 2024 21:18
Remove duplicate jobs from a Resque queue.

remove_duplicates.rb

Remove duplicate Resque jobs that have already been queued for processing.

Execute

To run this against a Rails installtion in production use the following command: bundle exec rails runner -e production /path/to/script/remove_duplicates.rb. See rails runner for more information.

Notes

# Original find_for_authentication from Devise authenticatable.rb
def find_for_authentication(conditions)
find(:first, :conditions => conditions)
end
# Overwrite find_for_authentication and put it in your User model
def self.find_for_authentication(conditions={})
unless conditions[:email] =~ /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i # email regex