Skip to content

Instantly share code, notes, and snippets.

View gist:198667ab25081b910c62c321eb8442dc
<div id="player-container" style="width:300px; height:250px;"></div>
<script type="text/javascript" src="https://yep.video.yahoo.com/oath/js/1/oath-player.js"></script>
<script>
var adAttempt = document.createElement('img');
adAttempt.src = 'https://log.adaptv.advertising.com/log?3a=adAttempt&1a8=0&1b6=2&25=105859&e3=1&5=1259780&14=72994&11d=5410713900515832&6a=-2&6b=-2&4f=29&fa=0&ff=0&121=3&14d=2506&12d=2828&optout=0&3=-2&5c=adaptv407&5b=5552&18=26326&2e=yahoo.com%2F%3Fadt%3D40%26debug_vssp%3D1%26debug_moat%3D1&2f=[URL]&30=yahoo.com&32=1&fd=360952&80=8647265838358384792-VA16a04931-e0b9-11ea-83ac-02ef50408e44&118=new_uuid&f8=VA16a04931-e0b9-11ea-83ac-02ef50408e44&171=1&190=0&42=false&77=008170221&67={playerRev}&d6=695cb688-8d2b-432a-889e-320d708d1db5&19d=1597689614354&bf=0&74=openrtb&ed=OneMDisplay&d5=1&d8=ip-10-112-106-167&ae=0&8e=-1&f0=-1&161=90.20&68=1&ctx.publisher_id=20459933223&ctx.pblob=pt%3Ahome%3Bver%3Amegastrm%3Bpl%3Aup|MxIDDTEwLjGotKgkXQFP4iv1MjAwMQAAAAAEbyQp|1197791536|LREC|MxIDDTEwLjGotKgkXQFP4iv
@woonketwong
woonketwong / gist:751499bf8eff8ee3ed32529c471b4309
Created Aug 26, 2020
player test config - Gemini ad with call to action
View gist:751499bf8eff8ee3ed32529c471b4309
{
"config": {
"mediaItems": [
{
"mimetype": "media/uplynk",
"id": "6fe02fc8903d44cca6843e3be5b68ecd",
"adConfig": {
"mimetype": "adplugin/vrm",
"value": {
"status": {
View traffic-api
CreativeDecorator.java
@Override
@SneakyThrows
public void mapBtoA(CreativeDecorated b, Creative a, MappingContext mappingContext) {
...
// layout is mandatory for display third party and
String layoutName = b.getLayout();
if (isThirdPartyDisplay || isHostedDisplay) {
if (isCreateOperation) {
View test-vpaid.xml
<?xml version="1.0" encoding="UTF-8"?>
<VAST version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="oxml.xsd">
<Ad id="1">
<InLine>
<AdSystem version="1.0">Adap.tv</AdSystem>
<AdTitle><![CDATA[Adap.tv Ad Unit]]></AdTitle>
<Impression> </Impression>
@woonketwong
woonketwong / findLocalMin
Created Feb 19, 2014
Suppose we are given an array A[1 .. n] with the special property that A[1] ≥ A[2] and A[n − 1] ≤ A[n]. We say that an element A[x] is a local minimum if it is less than or equal to both its neighbors, or more formally, if A[x − 1] ≥ A[x] and A[x] ≤ A[x + 1]. For example, there are five local minima in the following array: 9 7 7 2 1 3 7 5 4 7 3 3…
View findLocalMin
function findLocalMin(array, start, end){
var mid = Math.floor( (start + end)/2 );
if (((mid - 1) < 0) || ((mid + 1) >= array.length)) return null;
if (array[mid - 2] > array[mid - 1] && array[mid - 1] < array[mid]){
return array[mid-1];
} else if ( (array[mid-1] >= array[mid-2])){
return findLocalMin(array, start, mid);
} else {
View breadthFirstSearch
function breadthFirstSearch(node){
// build a queue
var q = [];
// initialize q
q.push(node);
var currentNode = null;
View depthFirstSearch
function depthFirstSearch(node){
if (node === null) return;
// visit node
console.log(node.value);
node.visited = true;
for (var i = 0; i < node.children.length; i++){
if (node.children[i].visited === false){
depthFirstSearch(node.children[i]);
View quickSort
function quickSort(array, start, end){
var leftIndex = partition(array, start, end);
if (start < leftIndex-1){
quickSort(array, start, leftIndex-1);
}
if (start > leftIndex){
quickSort(array, leftIndex, end);
@woonketwong
woonketwong / commonAncestor
Created Feb 18, 2014
Find the first common ancestor of two nodes in a binary tree. Avoid storing additional nodes in a data structure.
View commonAncestor
function covers(root, node){
if (root === null ) return false;
if (root === node ) return true;
return covers(root.left, node) || covers(root.right, node);
}
function commonAncestorHelper(root, node1, node2){
if (root === null ) return false;
if (root === node1 || root === node2 ) return root;
@woonketwong
woonketwong / createMinimalBST
Created Feb 17, 2014
Given a sorted array, write an algorithm to create a binary search tree with minimal height.
View createMinimalBST
function createMinimalBST(array, start, end){
if (end < start){
return null;
}
var mid = Math.floor( (start + end) / 2 );
var node = {val: array[mid], left: null, right: null};
node.left = createMinimalBST(array, start, mid-1);
node.right = createMinimalBST(array, mid+1, end);