Skip to content

Instantly share code, notes, and snippets.

View mattsandersuk's full-sized avatar
🐝

Matt Sanders mattsandersuk

🐝
  • UK
View GitHub Profile
@mattsandersuk
mattsandersuk / webpack.mix.js
Created February 1, 2018 22:39
Modified webpack config for Laravel Mix + Foundation.js compatibility
let mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
.*form_key.*
.*media/catalog.*
.*product_compare.*
.*media/wysiwyg.*
.*skin/frontend.*
.*wishlist/index.*
.*?p=.*
$( '.stat-counter' ).each(function() {
/**
*
* Get Vars from Data Attributes
*
*/
var numFrom = $(this).data('from'); // starting no.
var numTo = $(this).data('to'); // end no.
<?php
/**
* Split a postcode
* @param string $postcode
* @return array containing both outer and inner postcodes
*/
function split_postcode($postcode)
{
// remove spaces to be safe
@mattsandersuk
mattsandersuk / .deployconfig
Last active May 16, 2023 09:50
Super Simple, Customisable Deployment Script
DEST='host:path'
COMPILE_COMMAND='yarn production'
@mattsandersuk
mattsandersuk / wp-fix-jquery-live-function.php
Last active December 15, 2020 18:22
Hacky fix for the wp / divi console error `live is not a function`
<?php
add_action('admin_footer', function(){
echo "
<script>
jQuery.fn.extend({
live: function (event, callback) {
if (this.selector) {
jQuery(document).on(event, this.selector, callback);
}
@mattsandersuk
mattsandersuk / maintenance.php
Created August 14, 2023 09:37 — forked from bjornjohansen/maintenance.php
Custom WordPress maintenance mode page
<?php
wp_load_translations_early();
$protocol = wp_get_server_protocol();
header( "$protocol 503 Service Unavailable", true, 503 );
header( 'Content-Type: text/html; charset=utf-8' );
header( 'Retry-After: 30' );
?>
<!DOCTYPE html>
<html>