Skip to content

Instantly share code, notes, and snippets.

Mike Pjura mpjura

  • Hearst Digital Media
  • NY
View GitHub Profile
@mpjura
mpjura / override-document-write.js
Last active Aug 29, 2015
Override document.write
View override-document-write.js
(function() {
var old = document.write;
document.write = function( content ) {
if ( "interactive" === document.readyState ) {
console.log("document.write called after page load: ", content );
// optional.. safely append the content
// document.body.appendChild( content );
return;
}
View ae.js
var aeConfig = {
//URL of the Audience Engine end point
endpoint: "engine.hdmtools.com/get_teaser_block.json.php",
//Array of "blocks" (lists of stories) created in Audience Engine
blocks: [
{
//Each block has a name
name: "Smart Tout?",
//The container of the module being populated by Audience Engine
@mpjura
mpjura / debounced-scroll.js
Last active Aug 29, 2015
Debounced Scroll for Ads
View debounced-scroll.js
if ( !window.requestAnimationFrame ){
window.requestAnimationFrame = (function(){
return window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function( callback ) {
window.setTimeout( callback, 1000 / 60 );
};
})();
View gist:d76cfb1ba2193c3d4ce4
/* Rule Id: 418180 */
/* Rule Id: 404574 */
(function doAdTargeting() {
//wait for jquery
if (undefined === window.$) {
setTimeout(doAdTargeting, 10);
return;
}
@mpjura
mpjura / debug-console.js
Last active Aug 29, 2015
Overwrite console to only run when debug conditions are met
View debug-console.js
(function( window ){
var console = window.console;
var methods = ["log","dir"],
old = {};
//TODO - set this via query param or whatever you want
var debug = true;
You can’t perform that action at this time.