Skip to content

Instantly share code, notes, and snippets.

View 7LayersDesign's full-sized avatar

Andy Hutchins 7LayersDesign

View GitHub Profile
@7LayersDesign
7LayersDesign / teads_snippet.html
Created June 4, 2015 20:29
SNI Teads' snippet.
<!-- teads unit Hook -->
<div id="sni_teads_hook"></div>
<!-- outstream ad slot -->
<div id="dfp_outstream"></div>
@7LayersDesign
7LayersDesign / tcads.js
Last active August 29, 2015 14:21
ready wrap update
// Start init ready wrap
SniAds.ready(function(){
if (window.cqMobile) {
if ($('#tcad-bigbox-mobile')) {
SniAds.appendSlot('tcad-bigbox-mobile', 'dfp_bigbox');
}
}
else if (isRiverBoxAdExists) {
SniAds.River.appendAutoSlot('tcad-riverBox', false);
}
@7LayersDesign
7LayersDesign / scroll.js
Last active August 29, 2015 14:21
lazyload.js
// Prevent slot from being appended multiple times.
var slotAppended = 0;
// Contols rate at which the scroll event callback is run.
var _debounce = function(fn, delay) {
var timer = null;
return function () {
var context = this, args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
@7LayersDesign
7LayersDesign / blah
Created April 2, 2015 16:11
videoetargeting.js
{
"vp1": "1",
"vp2": "1", //WE dont use this currently, just here for example
"amzn_vid": "IJ8Qqgf0G0pfs5iesZbdXd4AAAFKdIToVAAAAAPsj9iWXQ"
}
#!/bin/bash
# nodereinstall
# credit: http://stackoverflow.com/a/11178106/2083544
#
# UPDATE: I've converted this gist to a repo:
# https://github.com/brock/node-reinstall
#
# get sudo
@7LayersDesign
7LayersDesign / sni-ads-descriptor-update.js
Created December 3, 2014 20:57
Example of the updated descriptor options for the new interstitial type options.
/**
* Notes:
* - Make sure slot intervals do not overlap. ie pislot: [1,3] and nislot [3,5].
* - The timer setting is optional. If left off, the default timer (in ads-config.js) will be used.
* - Timer sets how many seconds the gallery will be disabled.
* - Setting timer to 0 will disable the gallery blocking completely
* - The pislot is the default and always needed. nislot and vislot are optional.
* - If using the timer setting, the corresponsing interval set must be preset also.
* - Current descriptor versions are fully compatible with this update.
*
it("18.3 Restrict ad to 2 sizes for a specific ad type and set of mdManager values; adSlot 'sizes’ has only 1 size; all 4 adSlot 'mappings’ have only 1 size", function() {
var AD_SLOT_NAME = "dfp_bigbox";
var SIZE_OVERRIDE_ONE = [300, 250];
var SIZE_OVERRIDE_TWO = [301, 251];
var CUSTOM_KEYS = { "site": "food" };
SniAdsConfig.adSlots[0] = {
"tag": AD_SLOT_NAME,
"sizes": SIZE_OVERRIDE_ONE,
"mapping":{
@7LayersDesign
7LayersDesign / sniads.gallery.descriptor.js
Created November 11, 2014 21:36
Updated descriptor format.
@7LayersDesign
7LayersDesign / SniAds.init.js
Created November 11, 2014 20:25
Sample ad library initialization call.
SniAds.init({
breakpoints: {
small: [0,0],
medium: [600,0],
large: [800,0],
xlarge: [1920,0]
},
customKeys: {
"site" : "food"
,"sponsorship": "size_override_testing"
var cfg = {
breakpoints: {
// Bottom width limit.dont worry about it :)
small: [0,0],
// Width where page goes from phone to tablet format.
medium: [600,0],
// Width where page goes from tablet to desktop format.
large: [800,0],
// max point. not really used currently, but allows control over larger screen expierience. leave as [1920,0]
xlarge: [1920,0]