Skip to content

Instantly share code, notes, and snippets.

View kurtextrem's full-sized avatar

Jacob Groß kurtextrem

View GitHub Profile
@kurtextrem
kurtextrem / README.md
Last active December 19, 2024 13:35
Tame GTM & 3p scripts to improve INP

Tame GTM & 3p scripts to improve INP

Add this to before you load any 3p (especially GTM) in the document.

What it does is when it executes:

  • for click, auxclick, mousedown, keyup and submit, installs a document level addEventListener override that intercepts added listeners if it's likely they from from a 3p (-> based on the 3rd argument passed to the fn)

On the document load event (so that it executes after GTM etc.):

  • for the same events, installs a document.body level override
  • overrides dataLayer.push and gtag() to yield first
@kurtextrem
kurtextrem / debounce.js
Created October 5, 2016 08:35
Simple and small Throttle & debounce functions
// no leading call, only trailing
function debounce(callback, timeout, _time) {
timeout = timeout || 100;
return function debounce() {
window.clearTimeout(_time);
_time = window.setTimeout(callback, timeout);
}
}
@kurtextrem
kurtextrem / index.js
Created July 30, 2016 06:22
Throttle Function
function on_resize(namespace, callback, t) {
$(window).on('resize.' + namespace, function () {
clearTimeout(t);
t = setTimeout(callback, 100);
});
return callback;
}
@kurtextrem
kurtextrem / fast-bind.js
Created December 23, 2015 18:50 — forked from WebReflection/fast-bind.js
Function.prototype.bind is slow in JS, so we fix it plus we have great compatibility (at least for 90% of common cases without partial args)
+function(proto, Object) {
'use strict'
var originalBind = proto.bind
Object.defineProperty(proto, 'bind', {
value: function bind(context) {
var callback = this
return arguments.length === 1 ? function () { return callback.apply(context, arguments) } : originalBind.apply(callback, arguments)
}
})
}(Function.prototype, Object)
@kurtextrem
kurtextrem / .gitignore
Created June 26, 2014 07:08
Gulp minify
node_modules/
@kurtextrem
kurtextrem / dabblet.css
Created January 20, 2012 13:53
Untitled
@keyframes parade{
0% {
}
50% {
left: -100px;
transform: rotate(-50deg);
}
75% {
}
100% {
@kurtextrem
kurtextrem / dabblet.css
Created January 20, 2012 13:01
Untitled
#torwart {
position: relative;
top: -20.5em;
left: 13.5em;
}
#torwart > img {
height: 14em;
}
@kurtextrem
kurtextrem / dabblet.css
Created January 8, 2012 17:05
The left part of the background:
.clock{
/* The .clock div. Created dynamically by jQuery */
background-color:#252525;
height:200px;
width:200px;
position:relative;
overflow:hidden;
float:left;
}
@kurtextrem
kurtextrem / dabblet.css
Created December 18, 2011 14:11
Untitled
@import url('http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css');
@import url('http://fonts.googleapis.com/css?family=Handlee');
body {
background: url('img/noise.png');
}
#usermenu {
position: absolute;
right: 0;
left: auto !important;