Skip to content

Instantly share code, notes, and snippets.

View tihozdjelarevic's full-sized avatar

Tihomir Zdjelarevic tihozdjelarevic

  • Berlin
View GitHub Profile
@tihozdjelarevic
tihozdjelarevic / README.md
Created June 15, 2020 17:51 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@tihozdjelarevic
tihozdjelarevic / gist:43a475f574461697cca0810dfaf5b24c
Created September 16, 2019 12:46 — forked from getify/gist:1b26accb1a09aa53ad25
first draft sketch of a "Worker" polyfill
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Worker Polyfill</title>
<script src="polyfill.worker.js"></script>
</head>
<body>
<h1>Worker Polyfill</h1>
<script>
// Callback functions
//built-in callback functions
//setTimeout, Arr.forEach, geolocation.getCurrentPosition
//make your own callback functions
//setTimeout( hello, 2000, 'Bob')
let names = ['Inga','Tom','Mattias','Carlos'];
names.forEach(hello);
@tihozdjelarevic
tihozdjelarevic / allowlinker-ga.js
Created May 17, 2019 11:34 — forked from sahava/allowlinker-ga.js
This script reproduces Google Analytics' allowLinker plugin, resulting in a function that returns true if the linker parameter in the URL is valid and false otherwise. Uses the "old" linker plugin format. You can also pass a string as an argument to check if that string is a valid linker parameter.
var checkLinker = function(str) {
// First browser fingerprint method.
// Uses the clientId / gid string, user agent, time, and browser plugin descriptions.
var joiner = function (cidGid, offset) {
var a = new Date,
b = window.navigator,
c = b.plugins || [];
var d = [cidGid, b.userAgent, a.getTimezoneOffset(), a.getYear(), a.getDate(), a.getHours(), a.getMinutes() + offset];
for (var e = 0; e < c.length; ++e) {