Skip to content

Instantly share code, notes, and snippets.

Doug Cone nullvariable

Block or report user

Report or block nullvariable

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nullvariable
nullvariable / pantheon.yml
Created Sep 20, 2019
Create symlinks with Quicksilver
View pantheon.yml
api_version: 1
workflows:
sync_code:
after:
- type: webphp
description: Create symlinks
script: private/symlinks.php
@nullvariable
nullvariable / functions.php
Created Aug 20, 2019
Remove query strings from WordPress static assets
View functions.php
<?php
function remove_query_strings() {
if(!is_admin()) {
add_filter('script_loader_src', 'strip_query_string', 15);
add_filter('style_loader_src', 'strip_query_string', 15);
}
}
function strip_query_string($src){
$output = preg_split("/(&ver|\?ver)/", $src);
@nullvariable
nullvariable / cache-aggressive-license-checks.php
Created Aug 1, 2019
Make annoying WordPress plugins that constantly perform license checks in the admin behave.
View cache-aggressive-license-checks.php
<?php
/**
* Plugin Name: Cache Aggressive License Checks
* Description: Cache the license checks for plugins that are lame and check on every request.
* Author: Doug Cone
* Author URI: http://dougcone.com
* Version: 0.0.1
*
*/
@nullvariable
nullvariable / composer.json
Created May 7, 2019
Use typerocket with root composer.json
View composer.json
{
"require": {
"typerocket/core": "4.0.*"
},
"scripts": {
"typerocket-migrate": [
"php ./wp-content/mu-plugins/typerocket/galaxy migrate up"
]
}
}
@nullvariable
nullvariable / functions.php
Created Mar 12, 2019
don't send user count to wp.org stats.
View functions.php
<?php
add_filter( 'core_version_check_query_args', 'hide_stats', 99 );
function hide_stats( $query ) {
$query['blogs'] = 1;
$query['users'] = 1;
return $query;
}
@nullvariable
nullvariable / wp-cli.php
Last active Feb 27, 2019
use wp-cli as a proxy for typerocket galaxy commands
View wp-cli.php
<?php
if ( defined( 'WP_CLI' ) && WP_CLI ) {
\WP_CLI::add_command( 'galaxy', function () {
$count = count( $_SERVER['argv'] );
for ( $i = 0; $i < $count; $i++ ) {
// strip any preceeding arguments so galaxy isn't confused.
$arg = array_shift( $_SERVER['argv'] );
if ( 'galaxy' == $arg ) {
array_unshift( $_SERVER['argv'], 'galaxy' );
break;
@nullvariable
nullvariable / .lando.yml
Created May 10, 2018
lando/wordpress blog post
View .lando.yml
events:
post-db-import:
appserver: >
cd $LANDO_MOUNT
&& wp search-replace "//example.com" "//example.lndo.site" --all-tables
&& wp search-replace "//www.example.com" "//example.lndo.site" --all-tables
@nullvariable
nullvariable / .lando.yml
Last active May 10, 2018
lando/wordpress blog post examples
View .lando.yml
services:
pma:
type: phpmyadmin
hosts:
- database
mailhog:
type: mailhog
hogfrom:
- appserver
portforward: true
View gist:cadd8d05fd3b9965713cddecc8678225
docker cp <dbfile.sql> <container>:/tmp/import.sql
docker exec -it <container> /bin/bash
mysql -u <user> -p <database name> < import.sql
@nullvariable
nullvariable / index.php
Created Jan 27, 2017
set Craft to use local mailhog instance. Just drop in an existing plugin's init function, refresh and then remove (assumes you're using official Mailhog docker instance
View index.php
<?php
$mailhog_name = getenv('MAILHOG_NAME');
$mailhog_port = getenv('MAILHOG_PORT');
if ($mailhog_name && $mailhog_port) {
$hostname = array_slice(explode('/', getenv('MAILHOG_NAME')), -1, 1)[0];
$port = array_slice(explode(':', getenv('MAILHOG_PORT')), -1, 1)[0];
$settings = craft()->systemSettings->getSettings('email');
$settings['protocol'] = 'smtp';
$settings['port'] = $port;
$settings['host'] = $hostname;
You can’t perform that action at this time.