Skip to content

Instantly share code, notes, and snippets.

View natives.js
;(function() {
function getNatives(objects) {
if (typeof objects === 'string') {
objects = [objects]
}
var natives = {}
if (objects.length) {
var iframe = document.createElement('iframe')
iframe.style.display = 'none'
View taskQueue.js
(function() {
var tasks = []
function run() {
tasks.push(Array.prototype.slice.call(arguments))
waitThenRun()
}
function waitThenRun() {
requestAnimationFrame(function() {
if (tasks.length === 0) {
return
View fetchLinks.js
View cacheMisses.js
(function(w) {
if (w != top) return
w.addEventListener('load', function() {
var iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = location.href
document.body.appendChild(iframe)
iframe.addEventListener('load', function() {
var outer = w.performance
View waitForMark.js
(function(w) {
if (!w || !("performance" in w) || !w.performance || !performance.getEntriesByName) {
return;
}
BOOMR = w.BOOMR || {};
BOOMR.plugins = BOOMR.plugins || {};
BOOMR.plugins.WaitForMark = {
markFound: false,
init: function() {
View clearresourcetimings.js
(function(w){
if (!w || !w.performance) {
return;
}
var clearResourceTimings = w.performance.clearResourceTimings || w.performance.webkitClearResourceTimings;
if (!clearResourceTimings) {
return;
}
View gptlistener.js
(function() {
//https://developers.google.com/doubleclick-gpt/reference
var slots = ["ad_bnr_atf_01", "ad_bnr_btf_02"],
slotCount = window.performance && performance.mark ? slots.length : 0;
var boomr_ready = false;
BOOMR = window.BOOMR || {};
BOOMR.plugins = BOOMR.plugins || {};
BOOMR.plugins.GPT = {
@cvazac
cvazac / gist:c627d614abf226dbcc4d
Last active May 8, 2017
RUM-SpeedIndex boomerang.js plugin
View gist:c627d614abf226dbcc4d
/******************************************************************************
Copyright (c) 2014, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
@cvazac
cvazac / gist:34ce10b4b423b3e60c8f
Created May 28, 2015
BOOMR.addVar(...) `onBoomerangLoaded`
View gist:34ce10b4b423b3e60c8f
function addVars() {
BOOMR.addVar({
"UserId": SOASTA.UserId,
"ClientId": SOASTA.ClientId,
"GroupId": SOASTA.GroupId,
"UniqueId": SOASTA.UniqueId
});
}
if (document.addEventListener) {
@cvazac
cvazac / gist:c1554c3e9609041725a8
Created May 21, 2015
performance.setResourceTimingBufferSize for SPAs
View gist:c1554c3e9609041725a8
var setResourceTimingBufferSize == window && window.performance && (performance.setResourceTimingBufferSize || performance.webkitSetResourceTimingBufferSize);
if (setResourceTimingBufferSize) {
setResourceTimingBufferSize(<size>);
}