Skip to content

Instantly share code, notes, and snippets.

View brennandunn's full-sized avatar

Brennan Dunn brennandunn

View GitHub Profile
@brennandunn
brennandunn / gist:da2bce58af16d5577c82349221d587d9
Created February 10, 2023 12:08
Random number generation in ConvertKit
{% assign randomNumber = "now" | date: "%9N" | modulo: 10 | plus: 1 %}
{%- if randomNumber < 3 -%}
Message A
{%- else -%}
Message B
{%- endif -%}
$.ajax('https://ipapi.co/json/')
.then(
function success(response) {
window.geolocation = response;
loadRM();
},
function fail(data, status) {
loadRM();
}
{% capture tuples %}
{{ subscriber.field_a }},field_a|
{{ subscriber.field_b }},field_b|
{{ subscriber.field_c }},field_c|
{{ subscriber.field_d }},field_d
{% endcapture %}
{% assign sorted_tuples = tuples | split: "|" | sort | reverse %}
{% for tuple in sorted_tuples %}
{% assign tuple_array = tuple | split: "," %}
<script>
var lang = window.navigator.userLanguage || window.navigator.language;
lang = lang.slice(3, 5);
if (lang) lang = lang.toLowerCase();
window.userLanguage = lang;
</script>
require "jekyll"
require "nokogiri"
module Jekyll
class PersonalizeText
MAPPINGS = {
'email marketing tool' => 's-esp',
'email marketing app' => 's-esp',
'your email marketing database' => 's-esp',
@brennandunn
brennandunn / layout.html
Last active March 26, 2018 01:01
RightMessage "Hello Bar" layout template
<style>
#topbar {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
text-align: center;
background: #000;
form[data-drip-embedded-form] {
background: #fff url(data:image/gif;base64,R0lGODlhAQADAIABAMzMzP///yH/C1hNUCBEYXRhWE1QPD94cGFja…wbGhkYFxYVFBMSERAPDg0MCwoJCAcGBQQDAgEAACH5BAEAAAEALAAAAAABAAMAAAICRFIAOw==) repeat-y center top;
font-family: "Helvetica Neue", Helvetica, Arial, Verdana, sans-serif;
line-height: 1.5em;
overflow: hidden;
color: #666;
font-size: 16px;
border-top: solid 20px #3071b0;
border-top-color: #3071b0;
border-bottom: solid 10px #3d3d3d;
$(function(){
if (!$('form[data-drip-embedded-form]').length) _dcq.push(['showForm', { id: 'XXXXXXX' }])
}
$(function(){
params = jQuery.deparam.querystring()
for (var key in params) {
if (key.indexOf('utm') === 0) {
$('form#leadpages-form-selector-here').append(
$('<input type="hidden">').attr('name', key).val(params[key]))
)
}
}
$ = jQuery;
/*
* jQuery BBQ: Back Button & Query Library - v1.3pre - 8/26/2010
* http://benalman.com/projects/jquery-bbq-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/