Skip to content

Instantly share code, notes, and snippets.

View cbfranklin's full-sized avatar

Connor Franklin cbfranklin

  • E*TRADE
  • New York
View GitHub Profile
@cbfranklin
cbfranklin / gist:3875115
Created October 11, 2012 19:58
Try This Beverage, it's DIV-based.
<div style="width:286px;padding:10px;float:left;">
<strong><center>DOCUMENTS</center></strong><br>
<ul>
<li><a href="http://freedomtomarry.org/page/-/files/pdfs/SherkatAuditSummary.pdf">Executive Summary of Audit from Social Science Research</a>, by Sherkat (PDF)</li>
<li><a href="http://freedomtomarry.org/page/-/files/pdfs/sherkatauditfinal.pdf">Full Version of Audit from Social Science Research</a>,&nbsp;by Sherkat (PDF)</li>
<li><a href="http://freedomtomarry.org/page/-/files/pdfs/AmicusCritiqueOfRegnerusSummary.pdf">Amicus Brief countering claims in Regenerus Study</a>&nbsp;(PDF)</li>
</ul>
</div>
<div style="width:286px;padding:10px;float:left;">
<strong><center>SOCIOLOGISTS' CRITICAL COMMENTARY</center></strong><br>
var ieUserAgent = {
init: function () {
// Get the user agent string
var ua = navigator.userAgent;
this.compatibilityMode = false;
// Detect whether or not the browser is IE
var ieRegex = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (ieRegex.exec(ua) == null)
this.exception = "The user agent detected does not contai Internet Explorer.";
@cbfranklin
cbfranklin / AJAX Within existing HTML Content
Last active August 29, 2015 14:18
AJAX Within existing HTML Content
<div class="ajax load" data-url="/portal/content/100715" data-selector="#mileage-rate"></div>
@cbfranklin
cbfranklin / gist:da1ac18999b15994948f
Last active August 29, 2015 14:18
Hashchanges as Pageviews in UA
//adds verified JS route to gaCrumb for initial pageview report
if(window.location.hash.indexOf('#/') !== -1){
gaCrumb = gaCrumb + '/' + window.location.hash;
}
//fires verified JS route as additional "virtual pageview"
$(window).hashchange(function(){
if(window.location.hash.indexOf('#/') > -1){
if(gaCrumb.indexOf('#') > -1){
gaCrumb = gaCrumb.split('#')[0];
@cbfranklin
cbfranklin / gist:3008115f6d08d59d71fa9d07ecc33f98
Created August 15, 2016 20:47
Handle Results of Multiple AJAX Requests with jQuery Promises
function getReq(req, reqType) {
var fy1req = req + '/year/' + perDiemSearch.startFY;
function getStartFY() {
return $.ajax({
url: fy1req,
}).done(function(data) {
//no rates
if (!data.rates || data.rates.length === 0) {
@cbfranklin
cbfranklin / perdiem.js
Last active September 30, 2016 13:18
Fixes for GTM Events in CMP
/* The Per Diem tool reports custom events using Google Analytics ga() methods, and Google Tag Manager dataLayer objects.
It seems that some of these have been removed from the script, and others refactored in a way that prevents them from firing:
1. var "ga" returns undefined, preventing Google Analytics ga() methods from firing.
2. tests for the object "dataLayer" seem to be confused with other if statements. This is difficult to discern post-compression, but is clearly preventing event objects from reaching the GTM dataLayer.
*/
@cbfranklin
cbfranklin / APACHE: .htaccess pushstate
Created March 2, 2017 20:41 — forked from rayfranco/APACHE: .htaccess pushstate
.htaccess for HTML5 Pushstate support
<ifModule mod_rewrite.c>
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.html
</ifModule>
@cbfranklin
cbfranklin / jquery.hasClasses.js
Created March 20, 2017 16:06 — forked from mflorida/jquery.hasClasses.js
jQuery.hasClasses() plugin
/*!
* jQuery.hasClasses plugin
*
* Check if an element has ALL classes
* or ANY of a number of classes
*
* usage:
* $('#el-id').hasClasses('foo || bar') <- has EITHER 'foo' or 'bar'
* $('#el-id').hasClasses('|| foo bar') <- has EITHER 'foo' or 'bar'
* $('#el-id').hasClasses('any: foo bar') <- has EITHER 'foo' or 'bar'
<script>
(function() {
//set gaCrumb default
//create gaCrumb from breadcrumb
gaCrumb = '(not set)';
var gaCrumbPrep = [];
if ($('.breadcrumb').length > 0) {
$('.breadcrumb a').each(function() {
var crumbText = $(this).text();
if (crumbText.toLowerCase() !== 'home') {