Skip to content

Instantly share code, notes, and snippets.

Simon Vreeman simonvreeman

Block or report user

Report or block simonvreeman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View AB Testing Script
<script>
function createCookie(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = '; expires=' + date.toGMTString();
}
else var expires = '';
document.cookie = name + '=' + value + expires + '; path=/';
}
View Bookmarklet: Hide GTM Debug
javascript:(function()%7Bfunction callback()%7B(function(%24)%7Bvar jQuery%3D%24%3B%24( "iframe" ).hide()%3B%24( "body div" ).last().css( "display"%2C "none" )%7D)(jQuery.noConflict(true))%7Dvar s%3Ddocument.createElement("script")%3Bs.src%3D"https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.7.1%2Fjquery.min.js"%3Bif(s.addEventListener)%7Bs.addEventListener("load"%2Ccallback%2Cfalse)%7Delse if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)()
@simonvreeman
simonvreeman / Google Analytics Content Experiments code for Google Tag Manager
Last active Mar 6, 2017
With this script you are good to go for client-site A/B/n testing with Content Experiments. Add ?var=1 to preview the variation of the A/B test.
View Google Analytics Content Experiments code for Google Tag Manager
<script src="//www.google-analytics.com/cx/api.js?experiment=YOUR_EXPERIMENT_ID"></script>
<script>
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var varID = getParameterByName('var');
if(! varID){ var chosenVariation = cxApi.chooseVariation(); }
View Hide element
.hidden {
display: none !important;
visibility: hidden;
}
View gist:e87c11d50581f6e17a34
*,
*:before,
*:after {
text-rendering: optimizeLegibility;
-moz-osx-font-smoothing: grayscale !important;
-webkit-font-smoothing: antialiased !important;
font-smoothing: antialiased !important;
-moz-font-feature-settings: 'kern';
-ms-font-feature-settings: 'kern';
-o-font-feature-settings: 'kern';
View gist:f9353ce0397715f05cc0
<li><a href="mailto:?body=http://vreeman.com/tools/" target="_blank"><i class="fa fa-fw fa-envelope"></i> Email</a></li>
<li><a href="https://www.facebook.com/sharer/sharer.php?u=http://vreeman.com/tools/" target="_blank"><i class="fa fa-fw fa-facebook"></i> Facebook</a></li>
<li><a href="https://plus.google.com/share?url=http://vreeman.com/tools/" target="_blank"><i class="fa fa-fw fa-google-plus"></i> Google+</a></li>
<li><a href="https://www.linkedin.com/shareArticle?mini=true&url=http://vreeman.com/tools/" target="_blank"><i class="fa fa-fw fa-linkedin"></i> Linkedin</a></li>
<li><a href="https://twitter.com/intent/tweet?url=http://vreeman.com/tools/" target="_blank"><i class="fa fa-fw fa-twitter"></i> Twitter</a></li>
<li><a href="whatsapp://send?text=http://vreeman.com/tools/" target="_blank"><i class="fa fa-fw fa-share-square-o"></i> Whatsapp</a></li>
@simonvreeman
simonvreeman / Caps Lock Day
Created Aug 25, 2014
For vreeman.com via GTM
View Caps Lock Day
*{text-transform:uppercase!important;}
.fa{font-family:FontAwesome!important;}
@simonvreeman
simonvreeman / Comic Sans Dag
Created Aug 25, 2014
Voor vreeman.com via GTM
View Comic Sans Dag
*{font-family:Comic Sans,Comic Sans MS,Chalkboard,Marker Felt!important;}
.fa{font-family:FontAwesome!important;}
@simonvreeman
simonvreeman / gist:46ee538e148c2f1af1a7
Created Jul 13, 2014
A bookmarklet to add a link to vreeman.com/tools/
View gist:46ee538e148c2f1af1a7
javascript:void(prompt('Copy/Paste','<li><a%20href="'+location.href+'"%20target="_blank"%20rel="nofollow%20noreferrer">'+document.title+'</a></li>'))
View jsperf-bookmarklet.js
(function(){
var key = localStorage.wpt_key;
if (!key) {
var prompt = window.__proto__.prompt;
key = prompt('Your WebPagetest API key, please?');
if (!key) {
return gameOver();
}
localStorage.wpt_key = key;
You can’t perform that action at this time.