Skip to content

Instantly share code, notes, and snippets.

@zenmatt
zenmatt / aa_instructions.md
Created May 2, 2012 04:55 — forked from NZKoz/aa_instructions.md
Back Up All Your Gmail
  • Install getmail (aptitude install getmail4)
  • Set Up Your Imap Server (tl;dr)
  • getmail
  • ruby date_based_archive.rb ~/Maildir/.Archive
def things_I_tried
# didn't work
render :js => "alert('sucks')"
render :text => "<script>alert('blah')</script>;", :content_type => "text/javascript"
# worked
javascript_tag("alert('ftw')")
end
# 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={})
if conditions[:login] =~ /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i # email regex