Update indexed instance after blob analyzed
# app/jobs/active_storage/analyze_job_decorator.rb
module ActiveStorage::AnalyzeJobDecorator
def self.prepended(base)
base.around_perform do |job, block|
block.call
if($(window).scrollTop() + $(window).height() == $(document).height()) { | |
} |
// module... | |
// encapculates the properties of the function | |
// returns the function | |
String.method('deentity', function(){ | |
var entities = { | |
quote: '"', | |
lt: '<', | |
gt: '>' | |
}; |
var myRevealingModule = (function () { | |
var privateCounter = 0; | |
function privateFunction() { | |
privateCounter++; | |
} | |
function publicFunction() { | |
publicIncrement(); |
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 |
#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 |
du -h --max-depth 1 |
# 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 |
# Usage: | |
# class YourClass < ApplicationRecord | |
# denormalizable_collection :my_collection | |
# ... | |
# | |
# def self.my_collection_data | |
# self.where(...).limit(5) | |
# end | |
# end |
options = { | |
to: "recipient@address.com", | |
from: "email@address.org", | |
subject: "Testing", | |
body: "This is the body" | |
} | |
ActionMailer::Base.mail(options).deliver_now |