Skip to content

Instantly share code, notes, and snippets.

@madsheep
madsheep / nginx.conf
Created October 21, 2014 13:29
full nginx config
ssl on;
ssl_certificate /opt/nginx/certs/domain.crt;
ssl_certificate_key /opt/nginx/certs/domain.key;
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
@madsheep
madsheep / nginx.con
Created October 21, 2014 13:25
cache & headers
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
underscores_in_headers on;
@madsheep
madsheep / nginx.conf
Created October 21, 2014 13:22
ssl ciphers
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";
ssl_prefer_server_ciphers on;
@madsheep
madsheep / nginx.conf
Last active August 29, 2015 14:07
sample nginx ssl config
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
@madsheep
madsheep / membership.rb
Created May 19, 2014 09:54
not simple at all
class Membership
belongs_to :user
belogns_to :group
after_save :send_notifications, if: ->(m) { m.accepted_changed? && m.accepted? }
def send_notifications
Resque.enqeue(NotificationMailerWorker, self.id, user.id)
Resque.enqeue(PushNotifcations::NewMembershipWorker, self.id, user.id)
@madsheep
madsheep / membership.rb
Created April 29, 2014 12:29
not simple at all
class Membership
belongs_to :user
belogns_to :group
after_save :send_notifications, if: ->(m) { m.accepted_changed? && m.accepted? }
def send_notifications
Resque.enqeue(NotificationMailerWorker, self.id, user.id)
Resque.enqeue(PushNotifcations::NewMembershipWorker, self.id, user.id)
@madsheep
madsheep / membership.rb
Last active August 29, 2015 14:00
less and less simple
class Membership
belongs_to :user
belogns_to :group
after_save :send_notifications, if: ->(m) { m.accepted_changed? && m.accepted? }
def send_notifications
Resque.enqueue MembershipNotificationsWorker, self.id
end
class Membership
belongs_to :user
belogns_to :group
after_save :send_notifications, if: ->(m) { m.accepted_changed? && m.accepted? }
def send_notifications
NotificationMailer.accepted(self, user).deliver!
PushNotifcations::NewMembership.new(self, user).dispatch!
@madsheep
madsheep / membership.rb
Last active August 29, 2015 14:00
Less simple
class Membership
belongs_to :user
belogns_to :group
after_save :send_notifications, if: ->(m) { m.accepted_changed? && m.accepted? }
def send_notifications
NotificationMailer.accepted(self, user).deliver!
PushNotifcations::NewMembership.new(self, user).dispatch!
@madsheep
madsheep / membership.rb
Last active August 29, 2015 14:00
Still simple
class Membership
belongs_to :user
belongs_to :group
after_save :send_notifications, if: ->(m) { m.accepted_changed? && m.accepted? }
def send_notifications
NotificationMailer.accepted(self, user).deliver!
NotificationMailer.accepted_admin(self, group.admin).deliver!