Skip to content

Instantly share code, notes, and snippets.

View idanci's full-sized avatar
🏠
Working from home

Ivan Danci idanci

🏠
Working from home
View GitHub Profile
@jcsrb
jcsrb / gist:5569905
Last active December 17, 2015 06:59
this screams for metaprogramming
scope :created_this_hour , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_hour}' AND '#{DateTime.now.end_of_hour}'") }
scope :created_this_day , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_day}' AND '#{DateTime.now.end_of_day}'") }
scope :created_this_week , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_week}' AND '#{DateTime.now.end_of_week}'") }
scope :created_this_month , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_month}' AND '#{DateTime.now.end_of_month}'") }
scope :created_this_quarter , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_quarter}' AND '#{DateTime.now.end_of_quarter}'") }
scope :created_this_year , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_year}' AND '#{DateTime.now.end_of_year}'") }
@maxivak
maxivak / 00.md
Last active October 29, 2024 13:12
Sending emails with ActionMailer and Sidekiq

Sending emails with ActionMailer and Sidekiq

Send email asynchroniously using Sidekiq.

ActionMailer

Create your mailer us usual: