Skip to content

Instantly share code, notes, and snippets.

View xrsrke's full-sized avatar
🎯
focus

XλRI-U5 xrsrke

🎯
focus
View GitHub Profile
@xrsrke
xrsrke / minimal-analytics-snippet.js
Created December 14, 2018 23:26 — forked from DavidKuennen/minimal-analytics-snippet.js
Minimal Analytics Snippet
(function (history, trackingId, options) {
const getParameterByName = (paramName) => {
var searchString = window.location.search.substring(1),
i, val, params = searchString.split("&");
for (i=0;i<params.length;i++) {
val = params[i].split("=");
if (val[0] == paramName) {
return val[1] || undefined;
}
}
@xrsrke
xrsrke / array_merge_recursive_distinct.php
Created November 29, 2018 07:03 — forked from KaiCMueller/array_merge_recursive_distinct.php
Merging two multi dimensional arrays, overwriting existing values
<?php
/**
* array_merge_recursive does indeed merge arrays, but it converts values with duplicate
* keys to arrays rather than overwriting the value in the first array with the duplicate
* value in the second array, as array_merge does. I.e., with array_merge_recursive,
* this happens (documented behavior):
*
* array_merge_recursive(array('key' => 'org value'), array('key' => 'new value'));
* => array('key' => array('org value', 'new value'));