This file contains hidden or 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
class VideoAttachment < Attachment | |
validate :file_codec_validation, if: :new_record? | |
# Checks video file Codec format for Instagram | |
# Fails if not HEVC or H264 | |
# @see https://developers.facebook.com/docs/instagram-api/reference/ig-user/media#video-specifications | |
# @see https://github.com/ruby-av/av/blob/master/lib/av/commands/base.rb | |
def file_codec_validation | |
ffmpeg = `if command -v ffmpeg 2>/dev/null; then echo "true"; else echo "false"; fi` | |
av_probe = `if command -v avprobe 2>/dev/null; then echo "true"; else echo "false"; fi` |
This file contains hidden or 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
validate :file_codec_validation, if: :new_record? | |
# Checks video file Codec format for Instagram | |
# Fails if not HEVC or H264 | |
# @see https://developers.facebook.com/docs/instagram-api/reference/ig-user/media#video-specifications | |
# @see https://github.com/ruby-av/av/blob/master/lib/av/commands/base.rb | |
def file_codec_validation | |
ffmpeg = `if command -v ffmpeg 2>/dev/null; then echo "true"; else echo "false"; fi` | |
av_probe = `if command -v avprobe 2>/dev/null; then echo "true"; else echo "false"; fi` |
This file contains hidden or 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
user = User.find 151778 | |
stakeholder = user.stakeholder | |
em_subscription = EnterpriseManager::Subscription.find 2 | |
# Add user as manager of all EM gaggles | |
em_subscription.organizations.each do |organization| | |
organization.managers.find_or_create_by(user: user, role: "admin") | |
end | |
# Add user as member of all EM gaggles |
This file contains hidden or 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
1. All Star Dodge Chrysler Jeep Ram | |
-not found | |
2. Fisher Chrysler Dodge Jeep Ram Fiat | |
89306 | |
89859 | |
3. Stan McNabb Chrysler Dodge Jeep Ram Fiat | |
89433 | |
89872 |
This file contains hidden or 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
# Files in the config/locales directory are used for internationalization | |
# and are automatically loaded by Rails. If you want to use locales other | |
# than English, add the necessary files in this directory. | |
# | |
# To use the locales, use `I18n.t`: | |
# | |
# I18n.t 'hello' | |
# | |
# In views, this is aliased to just `t`: | |
# |
This file contains hidden or 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
METRICS = %w[post_impressions_organic_unique] | |
METRIC_ID_REGEX = %r{\/insights\/(\S+)\/lifetime} | |
facebook_handlers = [Activity::FacebookMessage, Activity::FacebookPhoto, Activity::FacebookVideo, Activity::FacebookReShare] | |
eligible_message_statuses = SMS.shared.joins(:message) | |
.where.not(share_id: nil) | |
.where(messages: { handler_type: facebook_handlers }) | |
.where(SMS.arel_table[:shared_at].gteq('1/1/2019'.to_datetime)) | |
queued_smses = [] | |
eligible_message_statuses.find_each do |sms| |
This file contains hidden or 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
# 1. Add "ZS Marketing" and "ZS Employer Branding" Tags to Gaggle 4441 | |
new_organization = Organization.find(4441) | |
marketing_tag = Tag.find_by(organization_id: 4441, name: 'ZS Employer Branding') # ZS Marketing tag already exists | |
branding_tag = Tag.create(organization_id: 4441, name: 'ZS Employer Branding') # create ZS Employer Branding tag | |
# 2. Tag all current Members in Gaggle 4441 with “ZS Marketing” | |
new_organization.stakeholders.includes(:tags).each do |s| | |
next if s.tags.include? marketing_tag | |
marketing_tag.stakeholders << s | |
end |
This file contains hidden or 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
# 1. Add "ZS Marketing" and "ZS Employer Branding" Tags to Gaggle 4441 | |
new_organization = Organization.find(4441) | |
marketing_tag = Tag.find_by(organization_id: 4441, name: 'ZS Employer Branding') # ZS Marketing tag already exists | |
branding_tag = Tag.create(organization_id: 4441, name: 'ZS Employer Branding') # create ZS Employer Branding tag | |
# 2. Tag all current Members in Gaggle 4441 with “ZS Marketing” | |
new_organization.stakeholders.includes(:tags).each do |s| | |
next if s.tags.include? marketing_tag | |
marketing_tag.stakeholders << s | |
end |
This file contains hidden or 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
### Contacts Table Migration | |
class CreateHubspotContacts < ActiveRecord::Migration[5.2] | |
def change | |
create_table :hubspot_contacts, id: false do |t| | |
t.string :contact_id | |
t.string :first_name, | |
t.string :last_name, | |
t.string :email, | |
t.string :contact_source, | |
t.string :lifecycle_stage, |
This file contains hidden or 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
User.find_each do |user| | |
next if user.email == user.email.downcase | |
user.email = user.email.downcase | |
user.skip_reconfirmation! | |
user.save(validate: false) | |
end |
NewerOlder