Skip to content

Instantly share code, notes, and snippets.

@sgelob
sgelob / user-timing-api-RUM-gtm.js
Last active Mar 14, 2021
Real User Monitoring of Web Performance with Navigation Timing API, Google Tag Manager and Google Analytics
View user-timing-api-RUM-gtm.js
/**
* 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 Dec 30, 2016
How to use ReactJS from the wrong end
View getOwnerInstance.js
// 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