Skip to content

Instantly share code, notes, and snippets.

View ptasker's full-sized avatar
:fishsticks:
Fishsticks FTW

Peter Tasker ptasker

:fishsticks:
Fishsticks FTW
View GitHub Profile
@ptasker
ptasker / jetpack-override.php
Last active September 29, 2016 16:31
Jetpack option override
<?php
/**
*
* Filter to not migrate the 'jetpack_options' value
*
* @param $options
*
* @return array
*
* From the tweaks plugin:
@ptasker
ptasker / wpmdb-list-all-subsites.php
Last active December 8, 2016 16:23
wpmdb-list-all-subsites.php
<?php
/*
Plugin Name: WPMDB - List all subsites
Plugin URI: https://gist.github.com/ptasker/3beaa16a5d0333cf49b0e202eaf40849
Description: Fixes get_sites() calls used in WP Migrate DB Pro to return a list of all sites
Author: Delicious Brains
Author URI: http://deliciousbrains.com
Version: 0.1
Network: True
*/
@ptasker
ptasker / default.sh
Created November 11, 2016 19:46
Nginx default server block
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@ptasker
ptasker / unsplashit-image-importer.sh
Last active December 7, 2016 01:02
Unsplash.it WordPress image importer
#!/usr/bin/env bash
DIR="$1"
COUNT="$2"
WP_DIR="$3"
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]
then
echo "Usage: $0 {photos folder dir path} $1 {number of photos} $2 {Absolute directory where WordPress is installed}"
exit 1
<?php
/*
Plugin Name: Annoying Plugin
Plugin URI:
Description: This is not a plugin
Author: Pete T
Version: 1.0
Author URI:
*/
@ptasker
ptasker / pre-commit.sh
Created May 10, 2017 18:24
ESLint pre-commit hook
#!/bin/bash
lint=$(./node_modules/eslint/bin/eslint.js src/**.js $a)
echo $lint
if [[ "$lint" != *""* ]]; then
echo "ERROR: ESLint failed, check hints"
exit 1 # reject
fi
@ptasker
ptasker / wp-remove-media.sh
Created May 11, 2017 18:01
WP CLI remove all media
#!/usr/bin/env bash
DIR="$1"
if [ -z "$1" ]
then
echo "Usage: $0 {WP install dir path}"
exit 1
fi
@ptasker
ptasker / curl-test.php
Created July 20, 2017 13:50
Test PHP cURL connections to the DBI API
<?php
$url = 'https://api.deliciousbrains.com';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
$result = curl_exec($ch);
curl_close($ch);
@ptasker
ptasker / zip-test.php
Created July 20, 2017 18:26
PHP Zip times
<?php
$PATH = '/your/folder/path';
//ZipArchive
//Test 1
$time_start = microtime( true );
@ptasker
ptasker / kickvalet.sh
Created November 15, 2017 19:44
Kick Valet
#!/bin/sh
sudo brew services stop nginx
sudo brew services stop php71
sudo brew services stop dnsmasq
sudo brew services stop mysql
sudo brew services start nginx
sudo brew services start php71
sudo brew services start dnsmasq
sudo brew services start mysql