Skip to content

Instantly share code, notes, and snippets.

@ryanjbonnell
ryanjbonnell / wp-config.php
Created Nov 7, 2013
WordPress Configuration for Multiple Environments
View wp-config.php
<?php
// Dynamically Set Environment Variables
$server[] = $_SERVER['HTTP_HOST'];
$server[] = $_SERVER['LOCAL_NAME'];
$environment->local[] = 'example.dev';
$environment->staging[] = 'staging.example.com';
if ( array_intersect( $environment->local, $server ) ) {
@ryanjbonnell
ryanjbonnell / wp-config.php
Created Nov 7, 2013
WordPress Configuration for Multiple Environments
View wp-config.php
<?php
// Define Environment Variables
$environment = new stdClass();
$environment->local = '/wp-config-local.php';
$environment->staging = '/wp-config-staging.php';
$environment->testing = '/wp-config-testing.php';
// Dynamically Set Environment Constants
define( 'WP_ENV_LOCAL', file_exists( ABSPATH . $environment->local ) );
define( 'WP_ENV_STAGING', file_exists( ABSPATH . $environment->staging ) );
@ryanjbonnell
ryanjbonnell / gist:1926630
Created Feb 27, 2012
jQuery Vegas Plugin output for WordPress
View gist:1926630
<?php if(get_field('slideshow')): ?>
<script src="<?php bloginfo('template_directory') ?>/js/jquery.vegas-1.2.min.js"></script>
<script>
jQuery(document).ready(function ($) {
$.vegas('slideshow', {
step: 0,
delay: 5000,
backgrounds: [
<?php
@ryanjbonnell
ryanjbonnell / drupal.sh
Created Feb 23, 2016
Install Drush and Terminus for Drupal at Pantheon using Homebrew
View drupal.sh
## Update Homebrew Formula(s)
$ brew update
$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/php
## Install Drush
$ brew install drush
@ryanjbonnell
ryanjbonnell / disable-local-plugins.php
Created Nov 7, 2013
Disable WordPress Plugins in Local Environment
View disable-local-plugins.php
<?php
/**
* Plugin Name: Disable Plugins in Local Environment
* Plugin URI:
* Description: Blacklist of Plugins to Disable When Working Locally
* Version: 0.1
* Author: Ryan J. Bonnell
* Author URI: https://gist.github.com/ryanjbonnell/
* License: WTFPL
@ryanjbonnell
ryanjbonnell / org.postfix.master.plist
Created Oct 12, 2016
macOS 10.12 "Sierra" Postfix Launch Daemon Property List
View org.postfix.master.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.postfix.master</string>
<key>Program</key>
<string>/usr/libexec/postfix/master</string>
<key>ProgramArguments</key>
<array>
@ryanjbonnell
ryanjbonnell / setup.sh
Created Oct 8, 2014
Install SassC + LibSass for Mac OS X 10.9 "Mavericks"
View setup.sh
# Install SassC Interpreter
$ cd /usr/local/src
$ curl -kL https://github.com/hcatlin/libsass/archive/master.zip > libsass.zip
$ unzip libsass.zip
# Install LibSass Library
$ cd /usr/local/src
$ curl -kL https://github.com/sass/sassc/archive/master.zip > sassc.zip
$ unzip sassc.zip
@ryanjbonnell
ryanjbonnell / wordpress-page-generation-stats.php
Last active May 14, 2017
Display WordPress Page Generation Stats for Performance Profiling
View wordpress-page-generation-stats.php
<?php
/**
* Display MySQL Query Count and Page Generation Time for Performance Profiling
* ------------------------------------------------------------------------------
*/
if ( ! function_exists( 'show_page_generation_stats' ) ) {
function show_page_generation_stats() {
if ( WP_DEBUG === true && current_user_can('administrator') ) {
global $wpdb;
@ryanjbonnell
ryanjbonnell / gist:4611642
Last active Nov 21, 2018
Install lynx on Mac OS X 10.8 "Mountain Lion"
View gist:4611642
cd /usr/local/src
curl -O http://lynx.isc.org/lynx2.8.7/lynx2.8.7.tar.gz
tar -xzvf lynx2.8.7.tar.gz
cd lynx2-8-7
./configure --mandir=/usr/share/man
make
sudo make install
@ryanjbonnell
ryanjbonnell / gist:4074061
Last active Mar 8, 2020
Install PHP APC on Mac OS X 10.8 "Mountain Lion"
View gist:4074061
# Compile PCRE - Perl Compatible Regular Expressions
cd /usr/local/src
curl -O ftp://ftp.csx.cam.ac.uk//pub/software/programming/pcre/pcre-8.31.tar.gz
tar -xvzf pcre-8.31.tar.gz
cd pcre-8.31
./configure
make
sudo make install
# Compile Autoconf