Skip to content

Instantly share code, notes, and snippets.

View AugustMiller's full-sized avatar
🌳

August Miller AugustMiller

🌳
View GitHub Profile
@AugustMiller
AugustMiller / deploy.php
Last active April 15, 2019 05:19
Boilerplate Deployer config for a Craft 3 project https://deployer.org
<?php
namespace Deployer;
require 'recipe/composer.php';
// Project name
set('application', 'my-project');
// Project repository
set('repository', 'git@github.com:organization/repo.git');
@AugustMiller
AugustMiller / image-resizer.liquid
Last active March 9, 2018 06:04
A roundabout way of re-building image URLs in Shopify without the `img_url` helper. Supports size declarations, but not cropping settings.
{% comment %}
Set up `transform` string for inclusion in a URL:
{% endcomment %}
{% if size %}
{% assign transform = size | prepend: '_' %}
{% else %}
{% assign transform = '' %}
{% endif %}
@AugustMiller
AugustMiller / serialize-form-as-object.coffee
Created September 26, 2017 01:48
Convert jQuery's `serializeArray` output into an object that better matches the structure of an HTTP request or POST body.
module.exports = (serializeArrayResult) ->
obj = {}
arr = serializeArrayResult
for pair in arr
if obj[pair.name] isnt undefined
if !Array.isArray obj[pair.name]
# Convert existing single value to an array:
obj[pair.name] = [obj[pair.name]]
@AugustMiller
AugustMiller / CustomKirbyValetDriver.php
Created June 27, 2017 00:36
Kirby Driver for Valet, with support for running the application in a subfolder of the project.
<? class CustomKirbyValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return void
*/
@AugustMiller
AugustMiller / SfscPlugin.php
Last active April 24, 2017 21:05
Sprout Form + Solspace Calendar
<? namespace Craft;
class SfscPlugin extends BasePlugin
{
public function getName()
{
return Craft::t('Event Attendance');
}
public function getVersion()
@AugustMiller
AugustMiller / banner.html
Created April 17, 2017 21:35
oof. Studio Banner
<!--
@@@@@@ @@@@@@ @@@@@@@@ @@@@@@ @@@@@@@ @@@ @@@ @@@@@@@ @@@ @@@@@@
@@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@ @@@@@@@ @@@ @@@ @@@@@@@@ @@@ @@@@@@@@
@@! @@@ @@! @@@ @@! !@@ @@! @@! @@@ @@! @@@ @@! @@! @@@
!@! @!@ !@! @!@ !@! !@! !@! !@! @!@ !@! @!@ !@! !@! @!@
@!@ !@! @!@ !@! @!!!:! !!@@!! @!! @!@ !@! @!@ !@! !!@ @!@ !@!
!@! !!! !@! !!! !!!!!: !!@!!! !!! !@! !!! !@! !!! !!! !@! !!!
!!: !!! !!: !!! !!: !:! !!: !!: !!! !!: !!! !!: !!: !!!
:!: !:! :!: !:! :!: :!: !:! :!: :!: !:! :!: !:! :!: :!: !:!
<? namespace Craft;
class HelpersPlugin extends BasePlugin
{
public function getName()
{
return Craft::t('Helpers');
}
public function getVersion()
@AugustMiller
AugustMiller / HelpersPlugin.php
Last active February 19, 2019 00:53
Basic asset cache busting plugin for Craft CMS.
<? namespace Craft;
# craft/plugins/helpers/HelpersPlugin.php
class HelpersPlugin extends BasePlugin
{
public function getName()
{
return Craft::t('Helpers');
}
@AugustMiller
AugustMiller / svg-classname.coffee
Last active January 20, 2017 19:50
SVG Classname Utility
getClass = (el) ->
if el.hasAttribute 'class'
el.getAttribute('class').split ' '
else
[]
hasClass = (el, className) ->
-1 < getClass(el).indexOf className
addClass = (el, className) ->
@AugustMiller
AugustMiller / mailgun-html.php
Created November 14, 2016 23:07
Kirby + Mailgun HTML Email service
<? email::$services['mailgun-html'] = function($email) {
if(empty($email->options['key'])) throw new Error('Missing Mailgun API key');
if(empty($email->options['domain'])) throw new Error('Missing Mailgun API domain');
$url = 'https://api.mailgun.net/v2/' . $email->options['domain'] . '/messages';
$auth = base64_encode('api:' . $email->options['key']);
$headers = array(
'Accept: application/json',