Skip to content

Instantly share code, notes, and snippets.

View peterchester's full-sized avatar

Peter Chester peterchester

View GitHub Profile
@peterchester
peterchester / gist:d2833d354e2af5d8dca4
Last active August 29, 2015 14:17
Git Info WP Plugin
<?php
/*
Plugin Name: Git Info
Plugin URI: https://github.com/jbrinley/wp-git-deploy
Description: Git info (abstracted from jbrinley's git deploy plugin)
Author: Modern Tribe, Inc.
Author URI: http://tri.be
Contributors: jbrinley
Version: 1.0
*/
@peterchester
peterchester / gist:6bcbae502dc946bc8a63
Created February 3, 2015 20:51
show-blog-belongs-to.php
<?php
/*
Plugin Name: Show User's Blogs
Description: Adds a list of what blogs a user belongs to to the user table.
Version: 1.0
Author: Modern Tribe, Inc.
*/
if(!class_exists('Show_Blog_Belongs')) {
class Show_Blog_Belongs {
public function __construct() {
@peterchester
peterchester / swap.sh
Last active April 13, 2024 20:22
A simple little shell script that executes the digital ocean swap file tutorial.
#/bin/sh
# Creates a 1gb swap image.
# @see https://www.digitalocean.com/community/tutorials/how-to-configure-virtual-memory-swap-file-on-a-vps
if [ -f /var/swap.img ]; then
echo "Swap file already exists."
else
touch /var/swap.img
chmod 600 /var/swap.img
@peterchester
peterchester / gdoc-backup.sh
Created July 16, 2014 23:54
Bash script for backing up selected google docs on a mounted google drive. Copies the files to new files with "BACKUP YYYY-MM-DD" added to the file name.
#! /bin/bash
# Google Drive path
BASEDIR='/Users/xxxx/Google Drive/'
# Files to backup
FILES=(
'Some Folder on Your Drive/Some Spreadsheet.gsheet'
'Some Other Folder on Your Drive/Some Doc.gdoc'
)
@peterchester
peterchester / gist:7504965aae068513b8c8
Created June 25, 2014 23:48
MvcImageResize - Mat's Fabulous WordPress Image Resizer
<?php
/*
Plugin Name: Mat's Fabulous Image Resizer
Description: Peter has hacked Mat's image resizer a bit to make it a stand alone plugin for the sake of team testing & inspection.
*/
/**
* Manage Image resizing on the fly to prevent a bunch of uneeded image sizes for every image uploaded
* Includes support for the Wp Smush.it plugin and will run the smush on all image sizes when generating the thumbnails. This also allow for smushing image larger than 1mb when
* using cropped sizes less than 1MB
@peterchester
peterchester / functions.php
Last active December 28, 2015 04:19
WordPress Image Widget support for SiteOrigin's Page Builder plugin. Put this in your functions.php file if you want the Image Widget (http://wordpress.org/plugins/image-widget/) to work with Page Builder (http://siteorigin.com/page-builder/).
/**
* Enqueue the necessary javascript to support the Image Widget in Site Origin's Page Builder
*/
function tribe_image_widget_siteorigin_page_builder_support() {
global $wp_widget_factory;
if ( isset( $wp_widget_factory->widgets ) && isset( $wp_widget_factory->widgets['Tribe_Image_Widget'] ) ) {
add_action( 'siteorigin_panel_enqueue_admin_scripts', array( $wp_widget_factory->widgets['Tribe_Image_Widget'], 'admin_setup' ) );
}
}
add_action('widgets_init', 'tribe_image_widget_siteorigin_page_builder_support', 999);
<?php
/*
Plugin Name: New Relic Config
Plugin URI: http://tri.be
Description: Configures New Relic
Author: Modern Tribe, Inc.
Author URI: http://tri.be
Version: 1.0
*/
/**
@peterchester
peterchester / postie_1_4_4_patch_2.diff
Created November 14, 2012 11:03
Postie 1.4.4 Patch #2
diff --git a/wp-content/plugins/postie/postie.php b/wp-content/plugins/postie/postie.php
index 9b94006415b74c3fcf2c5f667a9c277a14ab7f39..46d83ff3c226b3ecdca11ade57b8fcd267baac3d 100644
--- a/wp-content/plugins/postie/postie.php
+++ b/wp-content/plugins/postie/postie.php
@@ -76,9 +76,9 @@ if (is_admin()) {
add_action( 'admin_init', 'postie_admin_settings' );
add_action('admin_menu', 'postie_loadjs_add_page');
if(function_exists('load_plugin_textdomain')){
- $plugin_dir = WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__));
function postie_load_domain() {
@peterchester
peterchester / postie_1_4_4_patch_1.diff
Created November 14, 2012 11:02
Postie 1.4.4 Patch #1
diff --git a/wp-content/plugins/postie/postie-functions.php b/wp-content/plugins/postie/postie-functions.php
index ddf4cd8daf8ed4bdeb30978733e472ea97d96abd..75a598b1b6f77cb47a612a3d39b53a115f14a1cb 100644
--- a/wp-content/plugins/postie/postie-functions.php
+++ b/wp-content/plugins/postie/postie-functions.php
@@ -1,11 +1,41 @@
<?php
-$revisions= WP_POST_REVISIONS;
-define('WP_POST_REVISIONS', false);
-//define('POSTIE_DEBUG', true);
-if (!ini_get('safe_mode')) {
@peterchester
peterchester / gist:3971603
Created October 29, 2012 04:51 — forked from brandondove/gist:3969593
Sucuri Shirt Patch
<?php
if ( my_site_is_infected() ) {
visit( "sucuri.net" );
} else {
die();
}
?>