Skip to content

Instantly share code, notes, and snippets.

View M-Drummond's full-sized avatar
🦨

mackinley M-Drummond

🦨
  • 15:28 (UTC +10:00)
View GitHub Profile
{
products ( limit: -1 ) {
dateCreated @formatDateTime (format: "Y-m-d")
title
... on standard_Product {
description
image {
url @transform (handle: "general" )
}
productCategory {
@M-Drummond
M-Drummond / .eslintignore
Last active June 4, 2019 03:57
Basic Punchbuggy eslint setup
public/assets
web/assets/
node_modules
*.min.js
src/js/vendor/*
gulpfile.js
*.html
*.twig
@M-Drummond
M-Drummond / contact.twig
Created June 4, 2019 00:46
reCaptcha and Craft3
<form method="post" action="?" accept-charset="UTF-8" class="form" id="contact-form">
<input type="hidden" name="action" value="contact-form/send">
<label for="email" id="label-email">Your Email</label>
<input type="email" id="email" name="fromEmail">
<div class="g-recaptcha" data-sitekey="{{ reCaptcha.siteKey }}"></div>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
@M-Drummond
M-Drummond / srcSet.twig
Created March 26, 2019 22:54
Craft + imager data-srcset macro.
{% macro srcSet(image) %}
{# Lazyload + WebP enable iamge tag. #}
{# Create image sizes in JPG format #}
{% set jpg = [
{ width: 1080 , format: 'jpg' },
{ width: 900 , format: 'jpg'},
{ width: 720 , format: 'jpg'},
{ width: 480 , format: 'jpg' }
@M-Drummond
M-Drummond / grid-bloq.html
Created August 11, 2016 11:15
Bloqs - Grid layout as used on Warrawong Plaza.
{grid}
<section class="grid {if background_style == 'colour'}colour{/if} {if background_style == 'image'}image-bg{/if}" {if background_style == 'image'}style="background-image: url({background_image}); "{/if} >
<div class="container">
{if image_heading}<img src="{image_heading}" alt="{title}">
{if:else}
<h1>{title}</h1>
{if more}<a href="{more_link}" class="more">{more} <?php echo file_get_contents("images/icons/chevron-right.svg") ?></a>{/if}
{/if}
</div>
@M-Drummond
M-Drummond / analytics-external-link.js
Created May 25, 2016 23:34
Use Analytics to detect links to external pages.
@M-Drummond
M-Drummond / gulpfile.js
Last active March 30, 2016 00:28
Simple Sass + Watch Gulpfile
var gulp = require('gulp');
var sass = require('gulp-sass');
var input = '*.scss';
var output = '';
gulp.task('sass', function () {
return gulp
// Find all `.scss` files from the `stylesheets/` folder
.src(input)
@M-Drummond
M-Drummond / onClick.js
Created February 17, 2016 03:00
jQUery basic click handler
$('button').on('click', function() {
var message = $('<span>Call 1-555-jquery-air to book this tour</span>');
$('.usa').append(message);
$('button').remove();
});
@M-Drummond
M-Drummond / sheep-counter.js
Created January 18, 2016 00:44
javascript loop
var numSheep = 4; // number of sheep
var monthNumber = 1; // counting month
var monthsToPrint = 12; // max length of loop
while (monthNumber <= monthsToPrint) { // while months is less than the max length
numSheep *=4; // multiply the number by 4
console.log("There will be " + numSheep + " sheep after " + monthNumber + " month(s)!" ) ; // output concat. string
monthNumber++ ; // increment the month - will only occur below the maximum amount.
}
@M-Drummond
M-Drummond / horizontal-gravity.less
Created November 1, 2015 22:51
Horizontal gravity form for subscription.
/*------------------------------------*\
#SUBSCRIBE
\*------------------------------------*/
.module--subscribe {
background: #222223;
padding: 15px 0 ;
color: #fff;