Skip to content

Instantly share code, notes, and snippets.

@pablo-co
pablo-co / gist.rb
Last active November 4, 2022 18:23
Reprogramar notificaciones en ventana larga de tiempo
trigger_ids = %w[
]
trigger_ids.each do |id|
trigger = Trigger.find(id)
search_id = trigger.templates.where(template_type: "EmailTemplate").first.id
job = Delayed::Job.where(queue: "delivery_notification_job").where("handler ilike ?", "%#{search_id}%").first
job.update(run_at: Time.now + rand(60..1440).minutes) # 1 hour to 24 hours in the future.
end
@pablo-co
pablo-co / gist.rb
Last active November 4, 2022 17:25
Publish theme templatings for specific templates
THEME = Theme.find("92a77eb4-f904-4b16-badb-131245fa8af6");0
ids = []
%w[air premier 2now advance zero generic].each do |product|
%w[created in_transit problem delivered activation].each do |status|
["adicional"].each do |client_type|
template = THEME.templates.find_by!(name: "#{product} #{status} #{client_type}")
ids << template.id
end
end
@pablo-co
pablo-co / gist.rb
Last active November 3, 2022 21:09
Send test notificacions for each trigger variation empleados without publishing
EMAIL = "raul@kublau.com"
WORKSPACE = Workspace.friendly.find("rastreo");0
THEME = Theme.find("e392f012-b665-4693-a8ea-a6718a68b5af");0
TRACKER = WORKSPACE.trackers.find_by(tracking_code: "8454737362");0
TRIGGER = WORKSPACE.triggers.find("e2f9734e-34b1-43f7-a4da-e220da1c74a3")
def update_trigger(template)
params = {
subject: template.name,
selected_theme_template_id: template.id,
@pablo-co
pablo-co / gist.rb
Last active November 3, 2022 21:09
Send test notificacions for each trigger variation empleados
EMAIL = "raul@kublau.com"
WORKSPACE = Workspace.friendly.find("rastreo");0
TRACKER = WORKSPACE.trackers.find_by(tracking_code: "8454737362");0
def send_test_notification(trigger)
notification_params = {
trigger_id: trigger.id,
email: EMAIL,
phone: nil,
check_guards: false,
@pablo-co
pablo-co / gist.rb
Last active November 4, 2022 17:28
Publish all theme templatings
THEME = Theme.find("92a77eb4-f904-4b16-badb-131245fa8af6");0
ActiveRecord::Base.transaction do
THEME.render_theme_templatings.each do |rt|
rt.update_template_body!
end
end
@pablo-co
pablo-co / gist.rb
Last active November 4, 2022 17:32
Send test notificacions for each trigger variation
EMAIL = "pcardenas@3entre3.com"
WORKSPACE = Workspace.friendly.find("rastreo");0
TRACKER = WORKSPACE.trackers.find_by(tracking_code: "8454737362");0
def send_test_notification(trigger)
notification_params = {
trigger_id: trigger.id,
email: EMAIL,
phone: nil,
check_guards: false,
@pablo-co
pablo-co / Gemfile
Last active March 29, 2021 20:18
Search gist where reflex are isolated between tabs of the same user but push_state isn't.
gem "stimulus_reflex", "~> 3.4.1"
@pablo-co
pablo-co / nginx-noproxy.conf
Created February 25, 2016 04:15
Nginx fail2ban filter
[Definition]
failregex = ^<HOST> -.*GET http.*
ignoreregex =
@pablo-co
pablo-co / nginx-nohome.conf
Created February 25, 2016 04:14
Nginx fail2ban filter
[Definition]
failregex = ^<HOST> -.*GET .*/~.*
ignoreregex =
@pablo-co
pablo-co / nginx-noscript.conf
Created February 25, 2016 04:13
Nginx fail2ban filter
[Definition]
failregex = ^<HOST> -.*GET.*(\.php|\.asp|\.exe|\.pl|\.cgi|\.scgi)
ignoreregex =