Skip to content

Instantly share code, notes, and snippets.

// Copyright 2012 Google Inc. All Rights Reserved.
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@timelf123
timelf123 / AMA_LTL-UA_pixel_ratio.js
Last active December 21, 2015 23:28
ama LTL UA pixel ratio
// Create the test
var dpr = 1; // if no pixel ratio available. Assume 1:1.
if(window.devicePixelRatio !== undefined) dpr = window.devicePixelRatio;
// Pass it along through GA
ga('create', 'UA-37974233-3', 'amacoverage.com');
// --- IMPORTANT LINE!
// dimension1 - was set in UA interface before development of this code. Any new dimensions need to be added to the interface first
ga('set', 'dimension1', dpr);
@timelf123
timelf123 / avoid_console_errors.js
Created September 19, 2013 18:48
avoid console errors in browser
// Avoid `console` errors in browsers that lack a console.
(function() {
var method;
var noop = function() {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeStamp', 'trace', 'warn'
];
@timelf123
timelf123 / gist:6718329
Created September 26, 2013 18:19
all inputs, selects and textareas within .uniform have uniform() run on them
$('.uniform input:checkbox[class]').each(function() {
var checkboxClasses = $(this).attr('class');
$(this).parent().parent('div.checker').addClass(checkboxClasses);
});
$('.uniform input:radio[class]').each(function() {
var radioClasses = $(this).attr('class');
$(this).parent().parent('div.radio').addClass(radioClasses);
});
$('.uniform select[class]').each(function() {
var selectClasses = $(this).attr('class');
<?php
$DoNotTrackHeader = "DNT";
$DoNotTrackValue = "1";
$phpHeader = "HTTP_" . strtoupper(str_replace("-", "_", $DoNotTrackHeader));
if((array_key_exists($phpHeader, $_SERVER)) and ($_SERVER[$phpHeader] == $DoNotTrackValue))
{
// Do Not Track is enabled
}
@timelf123
timelf123 / pass_params_to_links.js
Created November 8, 2013 17:32
Drop this code on a splash page that links to your landing pages to append your tracking parameters.
<!DOCTYPE html>
<html>
<head>
<link href="http://vjs.zencdn.net/4.2.2/video-js.css" rel="stylesheet">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>
var isChrome = !!window.chrome;
if( isChrome ) {
@timelf123
timelf123 / SassMeister-input.scss
Created November 23, 2013 03:25
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
$di: (
main-image: url(../images/150639803_adj_1024.jpg),
main-image-hires:url(../images/150639803_adj_2048.jpg),
mobile-image:url(../images/150639803_adj_2048.jpg),
mobile-image-hires:url(../images/150639803_adj_2048.jpg),
@timelf123
timelf123 / SassMeister-input.scss
Created November 23, 2013 03:46
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
$main-image: url(../images/150639803_adj_1024.jpg);
$main-image-hires:url(../images/150639803_adj_2048.jpg);
$mobile-image:url(../images/150639803_adj_2048.jpg);
$mobile-image-hires:url(../images/150639803_adj_2048.jpg);
$product-color-overlay: url(../images/F08219-50.png);
@timelf123
timelf123 / SassMeister-input.scss
Created November 23, 2013 05:39
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
@import "compass";
@import "rwdcalc";
/*fixes for tool tips*/
.tooltip-trigger{