Skip to content

Instantly share code, notes, and snippets.

View ashleymason's full-sized avatar
🖤

Ashley Mason Kirk ashleymason

🖤
  • Twic
View GitHub Profile
@ashleymason
ashleymason / model_vs_database_constraint.md
Last active August 13, 2020 20:09
Model-Level Validations vs. Database Constraint

Model-Level Validations vs. Database Constraint

let's start with the TL;DR

  • what's better? database constraints or model validation?
    • no easy answer -- it depends on your problem
    • try to remember:
      • database constraints prevent bad data from being written
  • model validations allow for limitless specificity and quick pivots
@ashleymason
ashleymason / zip_cross_sell
Created October 10, 2019 12:33
using zip cross-sell for TV
1. Purchase a Realtor zip campaign (be sure to use a profile that has videos, like John Doe in Durham, NC)
2. Once the campaign is purchased, you should see the TV cross sell on the receipt page.
3. Click on the Watch my commercial CTA, and ensure you are able to complete the purchase of the TV Campaign.
@ashleymason
ashleymason / interstitial_instructions.txt
Created October 9, 2019 16:28
getting TV interstitial to display
There are 4 criteria for getting the interstitial to display in QA:
1. Partner has TV enabled
2. User has not purchased a TV campaign (drafts are fine)
3. Interstitial has not been show in past week / more than 5 times (Clear cookies/use incognito)
4. Current Agent is present
That last one is usually the issue when the interstitial is not displaying. The easiest way is to start the funnel
while signed in and search for the profile you want. Once selected, go back to the My Campaigns page and
partner = Partner[:luxpo]
partner.extra_data[:default_layouts][:retargeting] = {anx_web: 'luxpo_retargeting_web', facebook: 'luxpo_retargeting_fb'}
partner.save
pas = PartnerAutomationSetting.find_by(partner_id: partner.id)
pf = Partner::Feed.where(partner: partner, type: 'Partner::ListingFeed').first
@ashleymason
ashleymason / fb-likes-comments-qa-instructions.md
Last active February 18, 2019 16:31
Adding Facebook likes and comments to an Ad

To add Facebook comments and likes to the ad

Purchase a campaign and make it live, then:

rake webhook:facebook:comment:add[5,4]

where 5 is the FacebookAdCreative with id 5 and 4 is the number of comments.

if you would like to add likes

@ashleymason
ashleymason / partner_feed_sequence_runner.rb
Created January 16, 2019 15:03
Partner Feed Sequence Runner
Workers::PartnerData::PartnerFeedSequenceRunner.work(
partners: partner.code,
force_sync: true,
production_only: false,
do_not_queue: true,
limit: 100,
type: 'Partner::ListingFeed'
)
Workers::PartnerData::PartnerFeedSequenceRunner.work(
@ashleymason
ashleymason / admin_approve.rb
Created January 14, 2019 20:05
admin-approve all new luxpo campaigns
partner = Partner[:luxpo]
Campaign.joins(:campaign_insertion_order).
where(campaigns: {
partner_id: partner.id,
status: :pending_approval,
}
).
where(campaign_insertion_orders: { source: 'feed_automation'}).
find_each do |c|
@ashleymason
ashleymason / luxpo_retargeting_using_real_estate_ads.rb
Last active February 25, 2019 19:49
luxpo_retargeting_using_real_estate_ads
partner = Partner[:luxpo];
partner.extra_data[:default_layouts][:retargeting] = {anx_web: 'luxpo_retargeting_web', facebook: 'luxpo_retargeting_fb'};
partner.save;
pas = PartnerAutomationSetting.find_by(partner_id: partner.id);
unless pas.present?
pas = PartnerAutomationSetting.create(
automation_type: 'retargeting',
send_email: false,
launch_date: 1.year.ago,
@ashleymason
ashleymason / fun_with_imagemagick.rb
Created December 7, 2018 18:15
RMagick (ImageMagick) demo
# What is Imagemagick?
# open-source software for altering image files
# developed in 1987 by John Cristy for DuPont (older than Ruby!)
# originally developed to convert 24-bit images (16 million color) to
# 8-bit images (256-color), so they could be displayed on most screens
# copyright released in 1990 to ImageMagick Studio LLC, which is the organization
# that still maintains it today.
# https://github.com/rmagick/rmagick