Skip to content

Instantly share code, notes, and snippets.

View tpatch's full-sized avatar

Trevor Patch tpatch

View GitHub Profile
require('ET_Client.php');
$myclient = new \ET_Client();
// NOTE: These examples only work in accounts where the SubscriberKey functionality is not enabled
// SubscriberKey will need to be included in the props if that feature is enabled
// Create Subscriber
$subCreate = new \ET_Subscriber();
$subCreate->authStub = $myclient;
$subCreate->props = array("EmailAddress" => $email, "Lists" => array("ID" => $listId));
isMobile: function () {
var width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
if (width < 600) {
return true;
} else {
return false;
}
}
# -*- coding: utf-8 -*-
"""
@author: tpatch
"""
import pandas
import numpy
import seaborn
import matplotlib.pyplot as plt
@tpatch
tpatch / Module3.py
Created February 9, 2016 05:09
For online data visualization course
import pandas
import numpy
pandas.set_option('display.float_format', lambda x: '%f'%x)
data = pandas.read_csv('datasets/ool_pds.csv', low_memory=False)
data.columns = map(str.upper, data.columns)
print(len(data))
<amp-pixel src="https://ssl.google-analytics.com/collect?v=1&amp;tid=UA-XXXXXXXX-X&amp;t=pageview&amp;cid=$RANDOM&amp;dt=$TITLE&amp;dl=$CANONICAL_URL&amp;z=$RANDOM"></amp-pixel>
/*
* Required parameters:
* v = API version number (currently 1)
* tid = Google Analytics property identifier (UA-12345678-1)
* t = hit type
* cid = client id (you should implement this via cookie etc.)
* z = random string to bypass caching (amphtml generates this to $RANDOM variable)
*
@tpatch
tpatch / Python Data Script for Coursera
Created January 15, 2016 04:43
Python Data Script for Coursera
import pandas
import numpy
pandas.set_option('display.float_format', lambda x: '%f'%x)
data = pandas.read_csv('datasets/ool_pds.csv', low_memory=False)
data.columns = map(str.upper, data.columns)
print(len(data))
print(len(data.columns))
nav: function () {
// Uses href attribute containing a section ID;
// Example: <li class="slide-to"><a href="#learnmore">Learn More</a></li>
$('.slide-to').on('click', function(e) {
e.preventDefault();
var sectionId = $(this).children('a').attr('href');
$('html, body').animate({scrollTop:$(".section" + sectionId).position().top - 98}, 'slow');
});
}
function calcDistance($userLat, $userLon) {
$storeLat = ;
$storeLon = ;
$radlat1 = pi() * $userLat / 180;
$radlat2 = pi() * $storeLat / 180;
$radlon1 = pi() * $userLon / 180;
$radlon2 = pi() * $storeLon / 180;
$theta = $userLat - $storeLat;
$radtheta = pi() * $theta / 180;
@tpatch
tpatch / gist:52f887c66ec9d269cbbd
Created May 6, 2014 15:39
TJs Update Rotated Image
if (response == "true") $(".image[filename='" + filename + "'] img").src( $(".image[filename='" + filename + "'] img").src() + '?' + Math.random() );
<cfset var image = "" />
<cfset var jFile = "" />
<cfset var pathImage = ExpandPath(arguments.FilePath & "/image.jpg") />
<cffile action="upload" destination="#GetTempDirectory()#" fileField="#arguments.File#" nameconflict="overwrite" />
<cfscript>
image = ImageRead(cffile.SERVERDIRECTORY & "/" & cffile.SERVERFILE);
if (isImage(image)) {