Skip to content

Instantly share code, notes, and snippets.

@ryanjbonnell
ryanjbonnell / gist:6953571
Created October 12, 2013 18:56
Install Xcode 5.0 Command Line Tools for Mac OS X 10.9 "Mavericks"
$ xcode-select --install
@ryanjbonnell
ryanjbonnell / gist:6954813
Last active December 25, 2015 09:29
Determine MySQL Socket Locations and Permissions on Mac OS X
$ ls -al /tmp/mysql.sock; ls -al /var/mysql/mysql.sock
lrwxr-xr-x 1 root wheel 21 Oct 12 13:45 /tmp/mysql.sock -> /var/mysql/mysql.sock
srwxrwxrwx 1 _mysql wheel 0 Oct 12 13:51 /var/mysql/mysql.sock
ls: /tmp/mysql.sock: No such file or directory
srwxrwxrwx 1 _mysql wheel 0 Oct 12 13:51 /var/mysql/mysql.sock
@ryanjbonnell
ryanjbonnell / wp-config.php
Created November 7, 2013 16:38
WordPress Configuration for Multiple Environments
<?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 November 7, 2013 16:43
WordPress Configuration for Multiple Environments
<?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 / 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 / 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 / facebook-like-box.html
Created May 30, 2014 20:42
Load the Facebook JavaScript SDK Asynchronously
<div class="fb-like-box"
data-href="https://www.facebook.com/FacebookDevelopers"
data-colorscheme="light"
data-show-faces="true"
data-header="true"
data-stream="false"
data-show-border="true"
data-height="212">
</div>
@ryanjbonnell
ryanjbonnell / gist:b78002efbe6662703fa6
Created June 4, 2014 16:19
WordPress - MySQL Update Admin Email Address
UPDATE
wp_options
SET
option_value = 'username@example.com'
WHERE
option_name = 'admin_email';
@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 / mysql-reset-root-password.sh
Created August 5, 2014 05:55
MySQL - Reset Root Password
$ sudo /usr/local/mysql/support-files/mysql.server stop
$ sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables --skip-networking &
mysql> UPDATE mysql.user SET Password=PASSWORD('') WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit
$ mysql -h localhost -u root
mysql> set password=password('');
mysql> exit