Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Evan Mattson aaemnnosttv

:shipit:
View GitHub Profile
@aaemnnosttv
aaemnnosttv / soft-disable-plugins.php
Created May 20, 2014
Soft Disable All WP Plugins
View soft-disable-plugins.php
<?php
/**
* Plugin Name: Soft disable all WP plugins
* Author: Evan Mattson (@aaemnnosttv)
* Description: Allows all plugins to be softly disabled and re-enabled using a single constant.
* Version: 1.0
*
* Usage: Install this under mu-plugins/, and define('SOFT_DISABLE_PLUGINS', true) to soft disable all plugins.
* Delete/comment-out the constant definition or set to false to restore all plugins to their previous active states.
*
View pl2x-hook-map.php
pagelines_before_html
<html>
<head>
pagelines_head
wp_head
pagelines_head_last
</head>
<body>
pagelines_before_site
<div id="site">
View dev-debug-loader.php
<?php
if ( file_exists( WPMU_PLUGIN_DIR . '/dev-debug/dev-debug.php' ) )
require_once ( WPMU_PLUGIN_DIR . '/dev-debug/dev-debug.php' );
View call-shortcode.php
<?php
if ( ! function_exists('call_shortcode') ) :
/**
* Helper function for calling a shortcode directly
*
* Rather than `echo do_shortcode('[foo bar=the]')` ...
*
* echo call_shortcode('foo', ['bar' => 'the']);
@aaemnnosttv
aaemnnosttv / as3cf-upload-missing-media-library-items-to-s3.php
Last active Jul 14, 2022
AS3CF - Upload all missing media library items to S3
View as3cf-upload-missing-media-library-items-to-s3.php
<?php
/**
* For use with Amazon S3 and CloudFront by Delicious Brains
*
* Upload this file to your installation and trigger it with WP-CLI:
* wp eval-file as3cf-upload-missing-media-library-items-to-s3.php
*/
global $as3cf;
@aaemnnosttv
aaemnnosttv / config.yml
Created Aug 21, 2015
wp-cli base config
View config.yml
require:
- vendor/autoload.php
@aaemnnosttv
aaemnnosttv / drop-by-prefix.sql
Created Nov 16, 2015
mysql: Drop all tables by prefix
View drop-by-prefix.sql
SET GROUP_CONCAT_MAX_LEN=10000;
SET FOREIGN_KEY_CHECKS = 0;
SET @tbls = (SELECT GROUP_CONCAT(CONCAT('`', TABLE_NAME, '`'))
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'tablename_goes_here'
AND TABLE_NAME LIKE 'thetableprefix_%');
SET @delStmt = CONCAT('DROP TABLE ', @tbls);
-- SELECT @delStmt;
PREPARE stmt FROM @delStmt;
EXECUTE stmt;
@aaemnnosttv
aaemnnosttv / return.php
Created Jan 3, 2016
Simple value callback return generator
View return.php
<?php
if ( ! function_exists('__return') ) :
/**
* Simple return callback generator
*
* @param null $return
* @return Closure
*/
function __return($return = null) {
return function() use ($return) {
@aaemnnosttv
aaemnnosttv / aws-iam-s3-single-bucket-policy.json
Created Feb 12, 2016
AWS IAM S3 Single Bucket Policy Template (Full Access)
View aws-iam-s3-single-bucket-policy.json
{
"Statement": [
{
"Action": [
"s3:ListAllMyBuckets"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::*"
},
{
View mamp-to-valet.md

MAMP to Valet

One-time Dependency Setup/Configuration

Install Composer

wget https://getcomposer.org/download/1.1.0/composer.phar && chmod +x composer.phar && sudo mv /usr/local/bin/composer && composer self-update