Rails零散知识

 
1. 邮箱验证
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i

validates :email, presence: true, length: { maximum: 255 }, format: { with: VALID_EMAIL_REGEX }

Rails零散知识

2.md5加密
 在 Ruby 中,MD5 哈希算法由 Digest 库中的 hexdigest 方法实现:
  >> email = "MHARTL@example.COM"
  >> Digest::MD5::hexdigest(email.downcase)
  => "1fda4469bcbec3badf5418269ffc5968"
  
  
上一篇:[Learn Android Studio 汉化教程]第二章:Android Studio概述(一)


下一篇:XPOSED-LUA