View appcues-frame.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript"> | |
(function(window) { | |
// Allow listeners to subscribe to localStorage events. | |
var isObject = function(obj) { return Object.prototype.toString.call(obj) === '[object Object]' }, | |
listeners = []; | |
var postMessage = function(targetWindow, mesg, targetOrigin) { |
View catch-globals.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function evalCode(code) { | |
const func = new Function ('window', `with (window) { ${code} }`); | |
const obj = {}; | |
const proxy = new Proxy(obj, { | |
get(target, propKey, receiver) { | |
console.log(`GET ${String(propKey)}`); | |
if (propKey === 'window') return proxy; | |
return Reflect.get(window, propKey, receiver); | |
}, | |
set(target, propKey, value, receiver) { |
View filter-out-ads.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES5 for compat | |
window._trackJs.onError = function(error) { | |
try { | |
var fileURL = new URL(error.file); | |
if (fileURL) { | |
// safelist includes current domain + some third-parties we want to track | |
var safe = domainSafelist.some(function (domain) { | |
return fileURL.host.endsWith(domain); | |
}); |
View lhjson.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function strSize(obj) { | |
const string = JSON.stringify(obj); | |
return string ? string.length : 0; | |
} | |
const lhj = __LIGHTHOUSE_JSON__; | |
const fullSize = strSize(lhj); | |
const maxLevels = 5; |
View get-selector-simple.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const commonNodes = [ | |
'div', 'span', 'p', | |
'b', 'i', 'u', 'strong', 'em', | |
'h2', 'h3', | |
]; | |
/** | |
* @param {Array<string>} attributes | |
* @returns {Map<string, string>} | |
*/ |
View ps4devtools.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
let gamepad = null; | |
let loopInterval = null; | |
window.addEventListener("gamepadconnected", connectHandler); | |
window.addEventListener("gamepaddisconnected", disconnectHandler); | |
function connectHandler(e) { | |
if (!gamepad) { |
View extension.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const vscode = require('vscode'); | |
const path = require('path'); | |
// puppeteer is great because it's easy to use, but it comes with 30MB headless Chrome that | |
// we can't use as it doesn't have `Profiler.startTypeProfile` yet. We have to point to a | |
// locally installed Chrome Canary instead. It's fine for a POC, but puppeteer isn't probably | |
// a good fit in a long run. | |
const puppeteer = require('puppeteer'); | |
const PATH_TO_CANARY = '/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary'; |
View raf_throttler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rafThrottler(callback) { | |
let rafId = null; | |
const flush = () => { | |
callback(); | |
rafId = null; | |
}; | |
return () => { | |
if (rafId) { | |
return; |
View scroll_to.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rafId; | |
function scrollToElement(el, offsetTop = 0) { | |
scrollByValue(el.getBoundingClientRect().top - offsetTop); | |
} | |
function scrollByValue(offsetTop = 0) { | |
if (offsetTop !== 0) { | |
if (rafId) { | |
cancelAnimationFrame(rafId); |
View jsk.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* jsk.c | |
* | |
* Copyright (C) 2013, Frederic Kayser. | |
* | |
*/ | |
#include <stdio.h> | |
#include <stddef.h> |
NewerOlder