Skip to content

Instantly share code, notes, and snippets.

View wnstn's full-sized avatar

Winston Hearn wnstn

View GitHub Profile
@wnstn
wnstn / ad-preview-test.html
Last active April 22, 2020 22:51 — forked from techsassy/ad-preview-test.html
Let's render ads
<html>
<head>
</head>
<body>
<script type="text/javascript">
window.hymnalAdConfig = {
id: 'f609c3cf-0a54-4d7f-a4ba-e8f3a7b96572',
slug: '_test_client_cannes_demo_storybook_f609c3cf-0a54-4d7f-a4ba-e8f3a7b96572',
adName: "Cannes Demo Storybook",
type: 'Athena Template',
const uploadInput = document.querySelector('input[type="file"]');
const awsFormData = JSON.parse(uploadEl.getAttribute('data-form-data'));
const formData = new FormData();
Object.keys(awsFormData).forEach((key)=>{
formData.append(key, awsFormData[key]);
});
uploadInput.addEventListener('change', function(ev){
ev.preventDefault();
@s3_direct_post = ::S3.bucket
.presigned_post(key: thumbnail_upload_path,
success_action_status: '201',
content_type_starts_with: 'image/',
acl: 'public-read')
const uploadInput = document.querySelector('input[type="file"]');
const awsFormData = JSON.parse(uploadEl.getAttribute('data-form-data'));
const formData = new FormData();
Object.keys(awsFormData).forEach((key)=>{
formData.append(key, awsFormData[key]);
});
uploadInput.addEventListener('change', function(ev){
ev.preventDefault();
@wnstn
wnstn / fb-ad-disapprovals.js
Created December 12, 2017 15:49
Facebook's Ad Banning Categories
__d("CROWAdDisapprovalReasonEnum", [], (function a(b, c, d, e, f, g) {
f.exports = {
UNKNOWN: 0,
IRREGULAR_APP_INSTALL: 1,
TEXT_OVERLAY: 2,
ADULT_CONTENT: 3,
ADULT_HEALTH: 4,
ALCOHOL: 5,
ANIMATED_IMAGE: 6,
BEFORE_AND_AFTER: 7,
  • A metric starts its journey being added on the frontend, in Hymnal, as an impression tracker (in the tracker sidepanel). You can add as many trackers as you want per ad.
  • Separately, a clickthrough url is added, and notably, there is only one of these per ad.
    • In the refactor, we'll need to update how clickthrough urls are handled, since currently they're handled by metrics_instrumentation, but we'll be refactoring HymnalAd to be the one responsible for keeping track of an ad's clickthrough url.
    • We'll also need to update the rake task I wrote to migrate the current clickthrough_urls over to HymnalAds, from MetricsInstrumentation
  • From there, the tracker form is submitted, and for every tracker that was added, a new tracker object is created/saved in the db (after a check to make sure the url entered is a valid url)
<div id="google_ads_iframe_/172968584/verge/front_page_3__container__" style="border: 0pt none;"><iframe id="google_ads_iframe_/172968584/verge/front_page_3" title="3rd party ad content" name="google_ads_iframe_/172968584/verge/front_page_3" width="300" height="250" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" src="javascript:&quot;<html><body style='background:transparent'></body></html>&quot;" style="border: 0px; vertical-align: bottom;"></iframe></div>
<html><head>
<script type="text/javascript" async="" src="//assets.tapad.com/idsync-1.1.2.js"></script><script>var inDapIF=true;</script>
<script src="https://s0.2mdn.net/879366/express_html_inpage_rendering_lib_200_118.js" type="text/javascript" crossorigin="anonymous"></script><script src="//pixel.tapad.com/idsync/multi/urls?protocol=http&amp;callback=__tapad_partners"></script><script type="text/javascript" charset="UTF-8" src="//pagead2.googlesyndication.com/pagead/js/lidar.js"></script></head><body marginwidth="0" marginheight="0"><s

Keybase proof

I hereby claim:

  • I am wnstn on github.
  • I am wnstn (https://keybase.io/wnstn) on keybase.
  • I have a public key whose fingerprint is 305A 7753 6A93 3113 79BB 11F5 C00B 7B7E 64EB 49D9

To claim this, I am signing this object:

@wnstn
wnstn / gulpfile.js
Created January 22, 2016 14:26
Rails, Gulp, and Browsersync together at last
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var setupWatchers = function() {
gulp.watch(['./app/views/**/*.erb',
'./app/assets/javascripts/**/*.js'], ['reload']);
gulp.watch(['./app/assets/stylesheets/**/*.scss'], ['reloadCSS'])
};
gulp.task('reload', function(){
@wnstn
wnstn / SassMeister-input.scss
Created December 8, 2015 16:41
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
$reveal: nil;
@media only screen and (min-width: 1025px) {
// tests whether or not a reveal is true, if so it changes bg attachment to fixed
@mixin testReveal($r: null) {