Skip to content

Instantly share code, notes, and snippets.

# for all options ended in _id, setup the instance variable for liquid
options.select{|k,v| k.to_s.ends_with?('_id')}.each do |k,v|
new_key = k.to_s.gsub(/_id\z/, '')
instance = Resource.resource_by_table_name(new_key.pluralize)&.model&.find_by(id: v)
if instance.present?
# puts ["@" + new_key, v]
instance_variable_set("@" + new_key, instance)
end
end
x = NotificationEventCategory.where(title: 'purchase_concluded').first_or_initialize
x.save
n = Newsletter.new
n.title = 'xxx'
n.subject = '{{person.name}}'
n.body = '{{person.name}} e muito legal'
n.save
ne = n.notification_events.new
#!/bin/bash
#
# Adriano Mitre, 2016-09-19
#
mkdir -p ~/Downloads
cd ~/Downloads
NUM_CORES=6
# Git