Skip to content

Instantly share code, notes, and snippets.

@ryanjbonnell
ryanjbonnell / wp-config.php
Created March 12, 2014 15:51
WordPress Config: Use X-Forwarded-For HTTP Header to Get Visitor's Real IP Address
// Use X-Forwarded-For HTTP Header to Get Visitor's Real IP Address
if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
$http_x_headers = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );
$_SERVER['REMOTE_ADDR'] = $http_x_headers[0];
}
@ryanjbonnell
ryanjbonnell / gist:3880048
Last active March 23, 2023 18:01
Install Memcache on Mac OS X 10.8 "Mountain Lion"
# memcached requires libevent
cd /usr/local/src
curl -L -O http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.17-stable.tar.gz
tar -xvzf libevent-2.0.17-stable.tar.gz
cd libevent-2.0.17-stable*
./configure
make
sudo make install
# Compile memcached utility
@ryanjbonnell
ryanjbonnell / gist:4074061
Last active November 26, 2021 13:40
Install PHP APC on Mac OS X 10.8 "Mountain Lion"
# 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
@ryanjbonnell
ryanjbonnell / gist:c0f04ded19c35333f004
Last active February 8, 2021 00:23
Install PHP_CodeSniffer on Mac OS X for Drupal Coding Standards
# Install PEAR (PHP Extension and Application Repository)
$ sudo php /usr/lib/php/install-pear-nozlib.phar
$ sudo pear upgrade-all
$ sudo pear install --alldeps PHP_CodeSniffer
# Add PEAR to `php.ini` Include Path
$ nano /etc/php.ini
;include_path = ".:/php/includes"
include_path = ".:/php/includes:/usr/lib/php/pear"
@ryanjbonnell
ryanjbonnell / gist:4611642
Last active November 21, 2018 06:48
Install lynx on Mac OS X 10.8 "Mountain Lion"
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 / wordpress-page-generation-stats.php
Last active May 14, 2017 02:36
Display WordPress Page Generation Stats for Performance Profiling
<?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 / setup.sh
Created October 8, 2014 22:17
Install SassC + LibSass for Mac OS X 10.9 "Mavericks"
# 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 / org.postfix.master.plist
Created October 12, 2016 16:21
macOS 10.12 "Sierra" Postfix Launch Daemon Property List
<?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 / disable-local-plugins.php
Created November 7, 2013 16:48
Disable WordPress Plugins in Local Environment
<?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 / drupal.sh
Created February 23, 2016 21:49
Install Drush and Terminus for Drupal at Pantheon using Homebrew
## Update Homebrew Formula(s)
$ brew update
$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/php
## Install Drush
$ brew install drush