Skip to content

Instantly share code, notes, and snippets.

View croxton's full-sized avatar
💭
Up to my elbows, as usual

Mark Croxton croxton

💭
Up to my elbows, as usual
View GitHub Profile
@croxton
croxton / critical-css-with-js.twig
Last active November 3, 2020 08:30
Inline critical CSS with JS (Craft CMS)
{% set _inline_css_block = block('_inline_css') %}
{% if _inline_css_block is not empty %}
<script>
(function() {
/*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
!function(e){"use strict";var n=function(n,t,o){function i(e){return a.body?e():void setTimeout(function(){i(e)})}function r(){l.addEventListener&&l.removeEventListener("load",r),l.media=o||"all"}var d,a=e.document,l=a.createElement("link");if(t)d=t;else{var s=(a.body||a.getElementsByTagName("head")[0]).childNodes;d=s[s.length-1]}var f=a.styleSheets;l.rel="stylesheet",l.href=n,l.media="only x",i(function(){d.parentNode.insertBefore(l,t?d:d.nextSibling)});var u=function(e){for(var n=l.href,t=f.length;t--;)if(f[t].href===n)return e();setTimeout(function(){u(e)})};return l.addEventListener&&l.addEventListener("load",r),l.onloadcssdefined=u,u(r),l};"undefined"!=typeof exports?exports.loadCSS=n:e.loadCSS=n}("undefined"!=typeof global?global:this);
!function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={
@croxton
croxton / expresso_store_uk_postcodes.txt
Created November 27, 2017 10:30
Expresso Store match specific UK postcodes
Allow shipping rules to accept regex
***************************************************************
First, change the `postcode` column in `exp_store_shipping_rules` to type varchar(255).
./Store/src/Service/ShippingService.php
Change this:
/**
@croxton
croxton / expresso_store_uk_postcodes.txt
Created November 27, 2017 10:30
Expresso Store match specific UK postcodes
Allow shipping rules to accept regex
***************************************************************
First, change the `postcode` column in `exp_store_shipping_rules` to type varchar(255).
./Store/src/Service/ShippingService.php
Change this:
/**
@croxton
croxton / craftblockwrap.twig
Last active April 10, 2018 19:23
Craft CMS matrix blocks intelligent wrapping
{# _partials/blocks/blocks.html #}
{#
Blocks component
Outputs a matrix field blocks, intelligently wrapping blocks that need to be inset from the edges
@param {object} contentBlocks (MatrixBlockModel)
#}
{# Parameters #}
@croxton
croxton / SSL-certs-OSX.md
Last active June 3, 2025 17:42 — forked from leevigraham/Generate ssl certificates with Subject Alt Names on OSX.md
Generate ssl certificates with Subject Alt Names

Generate ssl certificates with Subject Alt Names on OSX

Open ssl.conf in a text editor.

Edit the domain(s) listed under the [alt_names] section so that they match the local domain name you want to use for your project, e.g.

DNS.1   = my-project.dev

Additional FQDNs can be added if required:

@croxton
croxton / imgix_responsive _images_on_the_fly.md
Last active April 10, 2018 17:57
Responsive images with imgix.js 3.x

These images are being sourced from https://hallmark-design.co.uk, which I have added as a "web folder" source in imgix. Please try it out with your own domain rather than use up my bandwidth :).

<!DOCTYPE html>
<html>

<head>
	<title>Test Imgix</title>
    	
	<!-- imgix config -->
@croxton
croxton / serverpilot_on_tagadab_cloud.md
Last active April 10, 2018 19:06
Manage a Tagadab Cloud server with Serverpilot
  1. In Tagadab cloud control panel create new server running Ubuntu 14.04.2 minimal, with backups enabled.

  2. Change Tools > Bootloader to server so it can load it's own kernel modules.

  3. Take snapshot (pre-upgrade-os).

  4. We need to update to Ubuntu 14.04.4 first. Login as root and run:

     sudo apt update
    

sudo apt dist-upgrade

@croxton
croxton / geeup.md
Last active April 8, 2018 02:24
GeeUp Workshop

#GeeUp workshop

These instructions will help you set up the EE Zen Garden locally and you should end up with a working website.

Initial set up

  1. Fork croxton/ee_zen_garden on Github

  2. Make a local clone of your fork:

     git clone [email protected]:my-account/ee_zen_garden.git
    
@croxton
croxton / bottrapips.txt
Created May 4, 2016 09:21
Bot Trap IPs captured May 2015 - May 2016
123.125.71.87
123.125.71.83
86.178.200.107
80.56.101.37
89.123.45.57
174.127.132.146
174.127.132.148
61.140.166.237
89.123.5.255
89.123.55.141
@croxton
croxton / nesting_ee_blocks_with_stash.md
Created November 25, 2015 10:09
Nesting EE blocks with Stash
{project_gallery}

	{!-- section --}
	{bk_gallery_section}

		<section class="gallery">

			{!-- save count of current section --}
			{exp:stash:set_value name="section_index" value="{blocks:count:of:type}" random}