Skip to content

Instantly share code, notes, and snippets.

View peteeveleigh's full-sized avatar

Pete Eveleigh peteeveleigh

View GitHub Profile
@peteeveleigh
peteeveleigh / _tweets.html
Last active December 25, 2015 21:08
Snippet to use with Click Rain's EE_Twitter add-on for ExpressionEngine (available here https://github.com/click-rain/EE_Twitter)
{exp:twitter:user screen_name="YOURTWITTERNAME" limit="5"}
{if no_results}
<p>No tweets to display</p>
{/if}
<article class="row {if retweeted}retweet{/if}">
{if retweeted}
<div class="retweetedavatars">
<img class="avatar retweeter" src="{retweeter:profile_image_url}">
<img class="avatar source" src="{profile_image_url}">
<?php if(!defined('KIRBY')) exit ?>
# default blueprint
title: Home
pages: true
files: true
fields:
title:
label: Title
@peteeveleigh
peteeveleigh / archive.php
Created January 19, 2014 18:36
Create a news archive of posts in Kirby
<?php
$archive = array();
$articles = $pages->find('news')
->children()
->visible()
->sortBy($sort='date', $dir='desc');
@peteeveleigh
peteeveleigh / _prefixes.scss
Last active August 29, 2015 14:01
Sass/SCSS Mixin to create vendor prefixes on any property:value pair
/*
Mixin to add vendor prefixes to any property:value
By default prefixes for -moz and -webkit will be created
By specifying a list as the third parameter a custom list of prefixes can be made
e.g.
.cheese {
@include prefix($foo,$bar,(moz,webkit,o,ms));
}

Tiny Content Framework

About the Project

This is a tiny content strategy framework focused on goals, messages, and branding. This is not a checklist. Use what you need and scrap the rest. Rewrite it or add to it. These topics should help you get to the bottom of things with clients and other people you work with.

Contribute

There’s more to come, and I’d love to hear what you think. Give me feedback on Twitter (@nicoleslaw) or by email (nicole@nicolefenton.com). We all benefit from sharing our ideas and creating standards. Onward.

@peteeveleigh
peteeveleigh / gist:94523eac6cd0876b799cd88aba252f93
Created May 9, 2016 17:37
Sample of Google Analytics transaction tracking for ExpressionEngine and Cartthrob
ga('require', 'ecommerce'); // Load the ecommerce plug-in.
ga('ecommerce:addTransaction', {
'id': '{order_id}', // Transaction ID. Required
'affiliation': '{site_name}', // Affiliation or store name
'revenue': '{exp:cartthrob:view_formatted_number number="{order_total}" prefix="" decimals="2" dec_point="." thousands_sep="" }', // Sub Total
'shipping': '{exp:cartthrob:view_formatted_number number="{order_shipping}" prefix="" decimals="2" dec_point="." thousands_sep="" }', // Shipping
'tax': '{exp:cartthrob:view_formatted_number number="{order_tax}" prefix="" decimals="2" dec_point="." thousands_sep="" }' // Tax
});
@peteeveleigh
peteeveleigh / index.php
Created July 5, 2017 20:51
PHP function to determine whether or not 2 lat/lon points are within a specified distance of each other (Great Circle)
<?php
$pointA = array(
'lat' => 51.863119,
'lon' => -2.21064
);
$pointB = array(
'lat' => 51.957807,
'lon' => -2.640603
@peteeveleigh
peteeveleigh / payment.html
Created November 27, 2017 14:52
Basic method for doing custom Stripe checkout form with Craft Commerce
{% if cart.paymentMethodId %}
<form method="POST" class="form" {% if cart.paymentMethod.class == 'Stripe' %}id="payment-form"{% endif %}>
<input type="hidden" name="action" value="commerce/payments/pay"/>
<input type="hidden" name="redirect" value="/checkout/complete?number={number}"/>
<input type="hidden" name="cancelUrl" value="/checkout/cancelled"/>
{{ getCsrfInput() }}
{% if errors is defined %}
.calendar {
tbody td {
border: 1px solid #dedede;
}
&__day {
&--available {
}
@peteeveleigh
peteeveleigh / rats.twig
Created November 16, 2018 17:55
RATS sequence generator in TWIG
{#
http://mathworld.wolfram.com/RATSSequence.html
A sequence produced by the instructions "reverse, add to the original, then sort the digits." For example, after 668, the next iteration is given by
668+866=1534,
so the next term is 1345.
Applied to 1, the sequence gives 1, 2, 4, 8, 16, 77, 145, 668, 1345, 6677, 13444, 55778, 133345, 666677, 1333444, 5567777, 12333445, 66666677, 133333444, 556667777, 1233334444, 5566667777, 12333334444, 55666667777, 123333334444, 556666667777, 1233333334444,
#}