Skip to content

Instantly share code, notes, and snippets.

@dylanvalade
dylanvalade / google-analytics-cross-domain-tracking-linker-plugin.html
Last active March 10, 2016 22:07
Google Analytics Cross Domain Tracking with Linker Plugin
<!-- Cross Domain Analytics Provided by Google Support -->
<!--
1. Log into Analytics and go to Admin > (Property Column) Tracking Info > Referral Exclusion List
2. Add each linked domain to the list, which says that these are not referrals - they are continutations of the same visit
-->
<!-- Primary Domain Tracking Script (e.g. hayowentha.org) -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@dylanvalade
dylanvalade / causedrop-paste-ad-scripts-example.html
Last active February 26, 2016 15:02
Causedrop Step 1: Add your cause's ad scripts. Fictional example for World Wide Fund for Nature (WWF)
<!-- WWF's Facebook Code for Ad Audience Targeting -->
<script type="text/javascript">
var fb_param = {};
fb_param.pixel_id = '60063372118';
fb_param.value = '0.00';
(function(){
var fpw = document.createElement('script');
fpw.async = true;
fpw.src = '//connect.facebook.net/en_US/fp.js';
var ref = document.getElementsByTagName('script')[0];
@dylanvalade
dylanvalade / causedrop-basic-install-example.html
Last active February 26, 2016 15:07
Causedrop Basic Install Example
<script>
// Use isogram attribute naming convention from Google
(function(i,s,o,g,r,a,m){
i['causedropObject']=r;
i[r]=i[r] || function(){
(i[r].q=i[r].q||[]).push(arguments)},
i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];
a.async=1;
@dylanvalade
dylanvalade / bootstrap-3-off-canvas
Last active September 9, 2015 18:07
Bootstrap off canvas nav component based on getbootstrap.com demo - CSS, HTML and JavaScript
/* CSS */
html,
body {
overflow-x: hidden; /* Prevent scroll on narrow devices */
}
@media screen and (max-width: 767px) {
.row-offcanvas {
position: relative;
@dylanvalade
dylanvalade / jquery-responsive-iframes.js
Last active April 7, 2016 01:52
jQuery Responsive iFrames
// Make all iframes responsive
// Handle video embeds with aspect ratio
// Input: void
// Return: void
// Dependencies: jQuery
// Call responsiveIframes() in $( document ).ready() or $( window ).load after any DOM manipulation
function responsiveIframes () {
// Handle iframes
if( $('iframe').length ) {
@dylanvalade
dylanvalade / bootstrap-3-dropdown-on-hover.css
Last active September 20, 2017 00:26
Bootstrap 3 Dropdown Menus On Hover
/* Enable Bootstrap Hover Drop Downs */
.dropdown-menu li:hover .sub-menu {
visibility: visible;
}
.dropdown:hover .dropdown-menu {
display: block;
}
@dylanvalade
dylanvalade / ie-8-bootstrap-3-shim
Last active September 9, 2015 16:34
IE 8 Compatible Bootstrap 3 Shim
<!-- Force older Internet Explorer to avoid compatibility mode -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Include HTML5 Shiv and Respond.js to IE 8 and earlier
https://github.com/aFarkas/html5shiv/blob/master/dist/html5shiv.min.js
https://github.com/scottjehl/Respond/blob/master/dest/respond.min.js -->
<!-- Include after bootstrap.js
HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- Updated to use CDN -->
@dylanvalade
dylanvalade / jquery.lazy.ajax.js
Last active April 23, 2022 03:50
Ajax jQuery Lazy Image Load
/*
For jQuery.lazy https://github.com/eisbehr-/jquery.lazy
You MUST have a src value on the img for lazy loading to run even if the preloader.gif doesn't exist
Do not leave that src attribute blank:
<img class="load" data-src="path_to/lazy-loaded-image.jpg" src="path_to/preloader.gif" />
In my ajax callback:
loadImages('img.load');
@dylanvalade
dylanvalade / bootstrap-3-xs-offset-shim.css
Created November 7, 2013 22:11
Add col-xs-offset-* shim to Bootstrap 3 for the mobile (xs) display responsive column offsetting that does not exist in the standard Bootstrap CSS.
/*
Include this after bootstrap.css
Add a class of 'col-xs-offset-*' and
if you want to disable the offset at a larger size add in 'col-*-offset-0'
Examples:
All display sizes (xs,sm,md,lg) have an offset of 1
<div class="col-xs-11 col-xs-offset-1 col-sm-3">