Skip to content

Instantly share code, notes, and snippets.

@ryanbattles
ryanbattles / referrer-tracking.js
Created November 16, 2015 16:51
Tracking Referrers
/* --------------------------------------------------
:: Track Referrers
-------------------------------------------------- */
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, " "));
}
@ryanbattles
ryanbattles / referral-tracking-for-app.js
Created November 16, 2015 16:56
Sets referral cookies to Intercom.io
window.intercomSettings = {
...
"harpoon_referrer" : $.cookie('harpoon_referrer'),
"utm_source" : $.cookie('utm_source'),
"utm_medium" : $.cookie('utm_medium'),
"utm_term" : $.cookie('utm_term'),
"utm_content" : $.cookie('utm_content'),
"utm_campaign" : $.cookie('utm_campaign')
};
@ryanbattles
ryanbattles / mobi-css.css
Created January 9, 2016 19:22
Custom CSS for Kindle Ebooks
html { text-rendering: optimizeLegibility !important; font-family: georgia, serif; }
h1, h2, h3 { -webkit-hyphens: none !important; font-family: Helvetica, sans-serif; }
h1 { page-break-before: always !important; }
h1, h2, h3, h4, h5, h6 { page-break-after: avoid !important; }
/* p + p { margin:0; text-indent:1.5em; } */
p {
margin-top:1.4em;
margin-bottom:1.4em;
text-align:left;