This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iptables -A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT && | |
iptables -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP && | |
iptables -A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP && | |
iptables -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,PSH,ACK,URG -j DROP && | |
iptables -A INPUT -i lo -j ACCEPT && | |
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT && | |
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT; | |
iptables-save > /etc/iptables.rules | |
iptables-restore < /etc/iptables.rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app/config/initializers/mailer.rb | |
ActionMailer::Base.smtp_settings = { | |
address: 'smtp.mandrillapp.com', | |
port: 587, | |
user_name: '<account email>', | |
password: '<api key>', | |
authentication: 'login' | |
} | |
ActionMailer::Base.delivery_method = :smtp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// module... | |
// encapculates the properties of the function | |
// returns the function | |
String.method('deentity', function(){ | |
var entities = { | |
quote: '"', | |
lt: '<', | |
gt: '>' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
du -h --max-depth 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# class YourClass < ApplicationRecord | |
# denormalizable_collection :my_collection | |
# ... | |
# | |
# def self.my_collection_data | |
# self.where(...).limit(5) | |
# end | |
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options = { | |
to: "recipient@address.com", | |
from: "email@address.org", | |
subject: "Testing", | |
body: "This is the body" | |
} | |
ActionMailer::Base.mail(options).deliver_now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Oneliner | |
require 'sidekiq/api'; [Sidekiq::Queue.all.each(&:clear), Sidekiq::ScheduledSet.new.clear, Sidekiq::RetrySet.new.clear, Sidekiq::DeadSet. | |
new.clear]; | |
require 'sidekiq/api'; | |
# 1. Clear retry set | |
Sidekiq::RetrySet.new.clear | |
# 2. Clear scheduled jobs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $("a.popup").each(function() { | |
// new PopupWindow($(this)) | |
// }); | |
class PopupWindow { | |
constructor($target){ | |
this.$target = $target | |
if (this.$target.length === 0) { | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myRevealingModule = (function () { | |
var privateCounter = 0; | |
function privateFunction() { | |
privateCounter++; | |
} | |
function publicFunction() { | |
publicIncrement(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if($(window).scrollTop() + $(window).height() == $(document).height()) { | |
} |
OlderNewer