Skip to content

Instantly share code, notes, and snippets.

@corradomatt
corradomatt / run-wp-cron.sh
Last active September 7, 2018 16:10 — forked from bjornjohansen/run-wp-cron.sh
Run cron on all sites on a server (works with multisite) - Thanks to https://gist.github.com/bjornjohansen/a00a9fee5475c4dadb56
#!/bin/bash
# Copyright © 2018 Matt Barrett - https://github.com/corradomatt
# Special thanks to https://gist.github.com/bjornjohansen/a00a9fee5475c4dadb56
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
HTML_ROOT="/var/www/html"
WP_CLI="/usr/local/bin/wp"
SITES=$(find $HTML_ROOT ! -path $HTML_ROOT -maxdepth 1 -type d -exec echo {} \;)
// if an invalid form field has been made valid,
// remove the shouty error highlighting - if a valid
// required field has been made invalid, start shouting
$('input, textarea, select').on('change', function(){
var $input = $(this);
var isRequired = $input.parents('.gfield').is('.gfield_contains_required');
var isValid = $input.is(':valid');
if ( isRequired && isValid ) {
<!DOCTYPE html>
<head>
<!--Little CSS fade in -->
<style>
.fadeIn{
-webkit-animation: fade-in 2s ease;
-moz-animation: fade-in ease-in-out 2s both;
-ms-animation: fade-in ease-in-out 2s both;
-o-animation: fade-in ease-in-out 2s both;
@corradomatt
corradomatt / compiler.php
Last active August 29, 2015 14:20 — forked from dovy/compiler.php
<?php
Redux::setSection( $opt_name, array(
'title' => __( 'Text Area', 'redux-framework-demo' ),
'desc' => __( 'For full documentation on this field, visit: ', 'redux-framework-demo' ) . '<a href="http://docs.reduxframework.com/core/fields/textarea/" target="_blank">http://docs.reduxframework.com/core/fields/textarea/</a>',
'id' => 'opt-textarea-subsection',
'subsection' => true,
'fields' => array(
array(
'id' => 'background-parallax',

First time server setup

  • Prerequisites: Git, Ruby, WP-CLI, Node.JS, NPM, Bower, Sass, Gulp, Grunt (Grunt as a backup)

Set up Wordpress using WP-CLI

mkdir project.com.au
cd project.com.au/
wp core download
mysql -u [mysql-username] -p
# Enter MySQL password
@corradomatt
corradomatt / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

<?php
/*
* Plugin Name: Commercial Client
* Plugin URI: http://pento.net/
* Description: A sample client plugin for showing updates for non-WordPress.org plugins
* Author: pento
* Version: 0.1
* Author URI: http://pento.net/
* License: GPL2+
*/