Skip to content

Instantly share code, notes, and snippets.

Avatar
🔭

Daniel Paz-Soldan danpaz

🔭
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am danpaz on github.
  • I am danpaz (https://keybase.io/danpaz) on keybase.
  • I have a public key whose fingerprint is 7CF5 EEA3 22C5 5BB3 A5E5 9A60 0AA7 4E1F 4162 23B8

To claim this, I am signing this object:

@danpaz
danpaz / prebid-winner.js
Last active Apr 30, 2019
Find Prebid winning bidder for one ad unit
View prebid-winner.js
window._pnq.push(['setId', '1'])
(function (adUnit) {
var googleAdSlot = googletag.pubads().getSlots().find(slot => slot.getSlotElementId() === adUnit);
var prebidAdId = googleAdSlot.getTargeting('hb_adid')[0];
var bids = pbjs.getBidResponses()[adUnit];
var winningBid = bids.bids.find(bid => bid.adId === prebidAdId);
return winningBid.bidder;
})("div-gpt-box-btf")
View utilities-sonnet.js
// A code sonnet for Utilities
util = require( 'util' );
switch( process.argv[2] ) {
case 'stdout':
util.puts( 'Hello World' );
util.log( 'Console log with a timestamp!' );
break;
case 'formatting':
var exdate = new Date();
var isdate = util.isDate( exdate );