Skip to content

Instantly share code, notes, and snippets.

View morganestes's full-sized avatar

Morgan Estes morganestes

View GitHub Profile
@morganestes
morganestes / phpcs.xml
Created April 11, 2017 20:13
PHP Code Sniffer ruleset for WordPress themes developed by BigWing Interactive.
<?xml version="1.0"?>
<ruleset name="BigWing WP">
<description>A custom coding standard for BigWing themes.</description>
<rule ref="WordPress-Extra">
<exclude name="Squiz.PHP.DisallowMultipleAssignments"/>
<exclude name="Squiz.Commenting.LongConditionClosingComment"/>
</rule>
<!--<rule ref="WordPress-Docs"/>-->
@morganestes
morganestes / wp-query.php
Created May 10, 2017 19:41
High-performance WP_Query for custom post types
<?php
/** High-performance, cached query for custom post types */
namespace Morgan_Estes\WP_Query;
/**
* Gets the cache group used by the plugin.
*
* @since x.x.x
* @uses \apply_filters()
@morganestes
morganestes / slackit.sh
Created May 25, 2017 19:14
Wrapper to use slackcat to upload files to a default channel
#!/usr/bin/env bash
# Uses http://slackcat.chat/ to upload a file to a Slack channel
function _slackit() {
if [ $# -eq 0 ]; then
echo 'No file provided.'
echo 'Usage: slackit <filename> [channel]'
return 0
fi
@morganestes
morganestes / .QLColorCode Custom Settings.md
Last active July 12, 2017 18:49
Custom settings for the syntax highlighting quick look package QLColorCode
@morganestes
morganestes / flush-network-rewrite-rules.sh
Created August 11, 2017 19:51
Flush rewrite rules for all sites in a network
#!/bin/sh
for site_url in $(wp site list --field=url); do wp rewrite flush --url=${site_url}; done
@morganestes
morganestes / wp-cli-regenerate-network-thubnails
Created August 11, 2017 20:05
Regenerate thumbnails for all sites in a WordPress network
#!/bin/sh
for site_url in $(wp site list --field=url); do wp media regenerate --only-missing --yes --url=${site_url}; done
@morganestes
morganestes / ok.bash-completion
Last active April 3, 2018 19:11
Enable bash completion of commands and projects for https://github.com/jonathantneal/ok
# Bash completion of commands and projects for https://github.com/jonathantneal/ok
__ok_completion() {
local commands projects
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
commands="$(find $HOME/.ok/command -name '*.sh' -exec basename {} .sh \;)"
@morganestes
morganestes / rando.coffee
Last active September 14, 2017 20:51
Hubot script for randomly annoying (or encouraging) a user
# Description:
# Chaos monkey. Randomly throws poo or flowers.
#
# Configuration:
# HUBOT_CHAOS_MONKEY_USERS
#
# Dependencies:
# None
#
# Commands:
@morganestes
morganestes / fit.json
Last active May 2, 2018 13:34
Fit Data
{
"bucket": [
{
"startTimeMillis": "1517205600000",
"endTimeMillis": "1517292000000",
"dataset": [
{
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:aggregated",
"point": [
{
@morganestes
morganestes / what-hooks.php
Created May 2, 2018 18:49
Find what's registered to WP hooks
<?php
add_action( 'wp', function() {
$callbacks = wp_list_pluck( $GLOBALS['wp_filter'], 'callbacks' );
var_export( $callbacks );
});