Skip to content

Instantly share code, notes, and snippets.

View wturnerharris's full-sized avatar

Wes Turner-Harris wturnerharris

View GitHub Profile
@wturnerharris
wturnerharris / functions.php
Created January 27, 2014 17:03
Override/Remove call to dynamic css in LaunchEffect: add to end of functions.php in main theme. In order to retain the css options for both premium and lite versions of LaunchEffect, you should first save the output from the dynamic css to the server and add as a link href in the Additional Scripts option of Launch Effect. <link rel="stylesheet"…
<?php
function return_void(){
exit;
}
add_action('wp_ajax_dynamic_css', 'return_void', 5);
add_action('wp_ajax_nopriv_dynamic_css', 'return_void', 5);
add_action('wp_ajax_dynamic_css_premium', 'return_void', 5);
add_action('wp_ajax_nopriv_dynamic_css_premium', 'return_void', 5);
@wturnerharris
wturnerharris / class-wp-profile-caps.php
Last active August 29, 2015 13:56
Class to display user capabilities in a table in the profile editor.
<?php
/**
* WP_Profile_Caps class.
*
*
* @package WP_Profile_Caps
* @since WP_Profile_Caps 0.1
*/
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
@wturnerharris
wturnerharris / nav-walker.php
Last active November 25, 2021 05:41
Use custom walker to modify wp_nav_menu()
<?php
/* **** USAGE ****
* <?php wp_nav_menu( array(
* 'walker' => new custom_walker_nav_menu()
* )); ?>
*/
class custom_walker_nav_menu extends Walker {
var $tree_type = array( 'post_type', 'taxonomy', 'custom' );
@wturnerharris
wturnerharris / w3tc-mu.md
Last active May 21, 2021 18:48
Install procedures to enable W3TC as a WordPress MU (must-use) plugin.

###W3TC MU-Plugins Install

  1. ####Add Apache Rewrite Rule -> .htaccess:

    • RewriteRule ^wp-content/plugins/w3-total-cache(/.*|)$ /wp-content/mu-plugins/w3-total-cache$1 [L,NC]
  2. ####Add WP-Config Option -> wp-config.php:

    • define('W3TC_DIR', dirname(FILE).'/wp-content/mu-plugins/w3-total-cache');
  3. ####Add w3tc plugin -> mu-plugins/:

  • Upload entire plugin to mu-plugins/w3-total-cache/
@wturnerharris
wturnerharris / deploy.php
Last active October 3, 2016 04:18
This is a generic deployment script for pushing changes via github to a server. Use this with a github webhook. The script should produce deployment.log and deployment.html for any errors and html output respectively.
<?php
/**
* Auto Deployment Script for GitHub and Apache.
*
*
* @since deploy 0.1
*/
$auth = md5('SET_YOUR_SECRET'); // set a private hash to validate against, result is your github secret
$target_branch = 'staging'; // this is the absolute branch to track
@wturnerharris
wturnerharris / rc.local
Last active August 26, 2016 19:33
Multi-user runlevel script (rc.local) for rPi #1
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
@wturnerharris
wturnerharris / xinitrc
Created January 20, 2015 20:35
X initialization script. This configures matchbox, resets chrome profile data, instructs the framebuffer to conform to explicit configuration, and starts an instance of chromium.
#!/bin/sh
while true; do
# Clean up previously running apps, gracefully at first then harshly
killall -TERM chromium 2>/dev/null;
killall -TERM matchbox-window-manager 2>/dev/null;
echo "Chrome and Matchbox terminated";
sleep 2;
killall -9 chromium 2>/dev/null;
@wturnerharris
wturnerharris / config.txt
Last active August 29, 2015 14:13
Raspberry Pi configuration file. This configures general layout and board overclocking properties.
# uncomment if you wish to disable the splash screen
disable_splash=1
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1
@wturnerharris
wturnerharris / reload.sh
Created January 20, 2015 20:55
This script reloads the top-most Chromium window and alerts any tty windows
#!/bin/bash
# set display
export DISPLAY=":0"
# set var to retrieve window id
WID=$(xdotool search --onlyvisible --class chromium|head -1)
# reload window according to cron schedule
if [ -n $WID ]; then
@wturnerharris
wturnerharris / wp_docker.sh
Last active August 29, 2015 14:18
quick docker init script
#!/bin/bash
if [ $# -eq 0 ]; then
printf "===> Needs s fully-qualified git repo\n"
exit
fi
printf "===> Installing dependencies...\n"
apt-get install -y wget nano git