Skip to content

Instantly share code, notes, and snippets.

@aaemnnosttv
aaemnnosttv / mamp-to-valet.md
Last active March 1, 2023 14:40
MAMP to Valet

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
@aaemnnosttv
aaemnnosttv / aws-iam-s3-single-bucket-policy.json
Created February 12, 2016 19:57
AWS IAM S3 Single Bucket Policy Template (Full Access)
{
"Statement": [
{
"Action": [
"s3:ListAllMyBuckets"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::*"
},
{
@aaemnnosttv
aaemnnosttv / return.php
Created January 3, 2016 02:21
Simple value callback return generator
<?php
if ( ! function_exists('__return') ) :
/**
* Simple return callback generator
*
* @param null $return
* @return Closure
*/
function __return($return = null) {
return function() use ($return) {
@aaemnnosttv
aaemnnosttv / drop-by-prefix.sql
Created November 16, 2015 23:44
mysql: Drop all tables by prefix
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 / config.yml
Created August 21, 2015 08:58
wp-cli base config
require:
- vendor/autoload.php
@aaemnnosttv
aaemnnosttv / as3cf-upload-missing-media-library-items-to-s3.php
Last active December 2, 2023 00:40
AS3CF - Upload all missing media library items to S3
<?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 / call-shortcode.php
Last active August 29, 2015 14:20
Call Shortcode
<?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 / dev-debug-loader.php
Last active August 29, 2015 14:14
Dev Debug Loader
<?php
if ( file_exists( WPMU_PLUGIN_DIR . '/dev-debug/dev-debug.php' ) )
require_once ( WPMU_PLUGIN_DIR . '/dev-debug/dev-debug.php' );
@aaemnnosttv
aaemnnosttv / pl2x-hook-map.php
Last active August 29, 2015 14:09
PL2X Hook Map
pagelines_before_html
<html>
<head>
pagelines_head
wp_head
pagelines_head_last
</head>
<body>
pagelines_before_site
<div id="site">
@aaemnnosttv
aaemnnosttv / soft-disable-plugins.php
Created May 20, 2014 18:01
Soft Disable All WP Plugins
<?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.
*