Skip to content

Instantly share code, notes, and snippets.

View wturnerharris's full-sized avatar

Wes Turner-Harris wturnerharris

View GitHub Profile
@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 / 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
@wturnerharris
wturnerharris / gitlab-deploy.php
Created September 1, 2015 22:52
This script will perform some tasks on a staging environment to simulate a full-on auto-deployment routine in gitlab
<?php
/**
* Auto Deployment Script for GitLab. Uses apache + php to perform tasks.
*
*
* @since deploy 0.2
*/
/**
* @internal The following variables are assumed to be valid but minimal validation is performed.
<link rel="icon" type="image/x-icon" href="<?php bloginfo('template_url'); ?>/im/favicon.png"/>
<!--[if IE]><link rel="shortcut icon" href="path/to/favicon.ico"><![endif]-->
@wturnerharris
wturnerharris / deploy.php
Last active December 24, 2015 10:08
Auto-deployment script for php, github, apache.
<?php
/**
* Auto Deployment Script for GitHub and Apache.
*
*
* @since deploy 0.1
*/
$auth = md5('SECRET_PHRASE'); // set a private hash to validate against
if ( empty($_REQUEST['auth']) || $_REQUEST['auth'] != $auth) exit;
@wturnerharris
wturnerharris / class-rewrite-rules.php
Created November 11, 2013 13:52
This class is an example of how to add rewrite rules and the actions to take should the rewrite be matched.
<?php
/**
* WP_Theme_Rewrites Class for WordPress.
*
*/
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
exit("Do not access this file directly.");
class WP_Theme_Rewrites {
@wturnerharris
wturnerharris / wp_custom_admin.php
Created December 4, 2013 19:11
Custom admin implementation for WP backend. This snippet provides references to removing and adding backend pages as well as custom roles and capabilities.
class WP_Admin_Pages {
var $reset_roles = false,
$page_name = "member_approvals",
$board_votes = "board_votes";
function __construct() {
if ( ! function_exists( 'admin_url' ) ) return false;
if ( is_admin() ) {
add_action( 'init', array(&$this, 'rolescheck'));
add_action( 'admin_menu', array(&$this, 'add_admin_page'));
@wturnerharris
wturnerharris / Hide_Gmail_Ads.js
Created January 11, 2014 19:52
Remove ad column from DOM in gmail and kill the remaining margin-right css property.
// ==UserScript==
// @name Hide Gmail Ads
// @namespace http://userscripts.org/users/540155
// @description Remove ad column from DOM in gmail and kill the remaining margin-right css property.
// @match https://mail.google.com/
// @include https://mail.google.com/*
// @include https://mail.google.com
// @grant GM_addStyle
// @version 0.1
// @copyright 2014+, You