Skip to content

Instantly share code, notes, and snippets.

View cdlewis's full-sized avatar

Chris Lewis cdlewis

View GitHub Profile
@cdlewis
cdlewis / jib.py
Created March 9, 2017 01:01
jib.py
# getPrimes takes one argument, maxNum, and returns all prime numbers
# that exist between 2 and maxNum using the sieve of erasmus algorithm
def getPrimes(maxNum):
primes = []
# create a list of all possible prime numbers between 2 and maxNum
candidates = [i for i in xrange(2, maxNum)]
# while there are possible prime numbers remaining
while len(candidates) > 0:
@cdlewis
cdlewis / zach.php
Created July 31, 2015 18:05
Zach.php
<?php
// Reconfigure TinyMCE
add_filter( 'tiny_mce_before_init', function( $settings ) {
$settings[ 'paste_as_text' ] = true;
return $settings;
} );
@cdlewis
cdlewis / iterable.md
Last active May 8, 2024 18:07
Handlebars for Iterable

Chris' Iterable Handlebars Cheat Sheet

Merge Parameters

Iterable merge paremeters have different brackets depending on whether it's a user object or a feed. These differences extend to functions operating on those parameters. For example, {{if}} needs to be [[if]] when evaluating a feed parameter.

User object

{{firstName}}
@cdlewis
cdlewis / fix_tumblr.php
Created June 12, 2015 01:39
Fix Tumblr
<?php
wp_oembed_remove_provider( '#https?://(.+)\.tumblr\.com/post/.*#i' );
wp_embed_register_handler( 'tumblr', '#https?://(.+)\.tumblr\.com/post/.*#i', function( $matches, $attr, $url, $rawattr ) {
$wp_oembed = _wp_oembed_get_object();
$args = '';
$provider = 'https://www.tumblr.com/oembed/1.0';
if( false === $data = $wp_oembed->fetch( $provider, $url, $args ) ) {
return false;
}
@cdlewis
cdlewis / gist:911d151f15b83fea850e
Created April 21, 2015 17:00
Iterable Error Message
Array
(
[response_code] => 400
[success] =>
[error_message] => Cannot schedule an email for the past: Apr 20, 2015 - 05:00 PM. Time travel not ready.
)
From 254c80a2dd08512a546dffad06ede4ca21fd9ff3 Mon Sep 17 00:00:00 2001
From: Adam Wojtonis <[email protected]>
Date: Tue, 20 Jan 2015 15:22:55 -0500
Subject: [PATCH] Adding trigger email functionality.
---
imge_gravity2mailjet.php | 43 ++++++++++++++++++++++++++++++++++++++++++
includes/template.html | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 92 insertions(+)
create mode 100644 includes/template.html
<div class="fb-video" data-allowfullscreen="true" data-href="https://www.facebook.com/video.php?v=833059266769536&amp;set=vb.247010942041041&amp;type=1">
<div class="fb-xfbml-parse-ignore">
<blockquote cite="https://www.facebook.com/video.php?v=833059266769536&amp;set=vb.247010942041041&amp;type=1">
<a href="https://www.facebook.com/video.php?v=833059266769536&amp;set=vb.247010942041041&amp;type=1"></a>
<p>A star is born.</p>Posted by <a href="https://www.facebook.com/video.php?v=833059266769536&amp;set=vb.247010942041041&amp;type=1">What The Flicka?</a> on Wednesday, 25 March 2015
</blockquote>
</div>
</div>
// Social Sharing URL
function social_sharing_url() {
var base_url = document.URL.replace( /\?.*?$/, '' );
query_params = []
if( window.title_variation ) {
query_params.push( [ 'title_var', window.title_variation ] );
}
if( window.optimizely_query_key ) {
query_params.push( [ window.optimizely_query_key, window.optimizely_query_value ] );
}
<div id="div-gpt-ad-1393444597560-0" style="width:300px; height:250px;">
<script type="text/javascript">
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1393444597560-0'); });
</script>
<div id="google_ads_iframe_/22633255/IJR_Articles_BTF_300x250_0__container__" style="border: 0pt none;"><iframe id="google_ads_iframe_/22633255/IJR_Articles_BTF_300x250_0" name="google_ads_iframe_/22633255/IJR_Articles_BTF_300x250_0" width="300" height="250" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" src="javascript:&quot;<html><body style='background:transparent'></body></html>&quot;" style="border: 0px; vertical-align: bottom;"></iframe></div><iframe id="google_ads_iframe_/22633255/IJR_Articles_BTF_300x250_0__hidden__" name="google_ads_iframe_/22633255/IJR_Articles_BTF_300x250_0__hidden__" width="0" height="0" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" src="javascript:&quot;<html><body style='background:transparent'></body></html>&quot;" style="border: 0px; vertical-ali
<div id="div-gpt-ad-1413991104862-0" style="width:300px; height:250px;">
<script type="text/javascript">
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1413991104862-0'); });
</script>
<div id="google_ads_iframe_/22633255/IJReview_YHMG_VideoUnit_300x250_0__container__" style="border: 0pt none;"><iframe id="google_ads_iframe_/22633255/IJReview_YHMG_VideoUnit_300x250_0" name="google_ads_iframe_/22633255/IJReview_YHMG_VideoUnit_300x250_0" width="300" height="250" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" src="javascript:&quot;<html><body style='background:transparent'></body></html>&quot;" style="border: 0px; vertical-align: bottom;"></iframe></div><iframe id="google_ads_iframe_/22633255/IJReview_YHMG_VideoUnit_300x250_0__hidden__" name="google_ads_iframe_/22633255/IJReview_YHMG_VideoUnit_300x250_0__hidden__" width="0" height="0" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" src="javascript:&quot;<html><body style='background:transparent'></body></html>&quot