Skip to content

Instantly share code, notes, and snippets.

@sgelob
sgelob / user-timing-api-RUM-gtm.js
Last active March 14, 2021 05:03
Real User Monitoring of Web Performance with Navigation Timing API, Google Tag Manager and Google Analytics
/**
* user-timing-api-RUM-gtm.js 1.0.1
* Olegs Belousovs @sgelob
*/
(function() {
"use strict";
// From https://github.com/addyosmani/timing.js/ –––>
var performance = window.performance || window.webkitPerformance || window.msPerformance || window.mozPerformance;
@noodlebox
noodlebox / getOwnerInstance.js
Created December 30, 2016 19:46
How to use ReactJS from the wrong end
// This is super hackish, and will likely break as Discord's internal API changes
// Anything using this or what it returns should be prepared to catch some exceptions
const getInternalInstance = e => e[Object.keys(e).find(k => k.startsWith("__reactInternalInstance"))];
function getOwnerInstance(e, {include, exclude=["Popout", "Tooltip", "Scroller", "BackgroundFlash"]} = {}) {
if (e === undefined) {
return undefined;
}
// Set up filter; if no include filter is given, match all except those in exclude