Skip to content

Instantly share code, notes, and snippets.

View DrizzlyOwl's full-sized avatar

Ash Davies DrizzlyOwl

View GitHub Profile
@DrizzlyOwl
DrizzlyOwl / admin.php
Last active March 10, 2017 11:18
WP REST API Disable
<?php
/**
* $. Remove & disable JSON API
******************************************************************************/
function wpst_remove_json_api() {
/**
* Remove API scripts from header/footer
*/

Multiple MySQL Versions with Homebrew

For homebrew version 0.9.5.

brew -v # => Homebrew 0.9.5

Install the current version of mysql.

# Install current mysql version

brew install mysql

@DrizzlyOwl
DrizzlyOwl / .zshrc
Last active October 26, 2022 10:52
# Path to oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="af-magic"
# jbergantine is like toothpaste = good
# eastwood is nice and clean
# flazz is good
# nicoulaj is also good
# steeef is good
# half-life is good
<Directory "/Users/ashleydavies/sites">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
<Virtualhost *:80>
VirtualDocumentRoot "/Users/ashleydavies/sites/_localhost"
UseCanonicalName Off
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@DrizzlyOwl
DrizzlyOwl / functions.php
Created September 29, 2016 13:17 — forked from wpscholar/functions.php
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
@DrizzlyOwl
DrizzlyOwl / functions.php
Created May 25, 2016 11:22
WordPress protected page template
<?php
/**
* Load a different template if a user without 'contributor' permissions lands on a page which uses the
* tpl-protected.php template
*
* @param $template
* @return string
*/
function filter_protected_page( $template ) {
global $post;
@DrizzlyOwl
DrizzlyOwl / search.php
Last active February 17, 2016 15:07
WordPress Search template
<?php
// Get the header
get_header();
// Results pagination offset
$offset = ($_GET["offset"] ? $_GET["offset"] : 0);
// load the global query ++ the global searched keyword
global $wp_query, $s;
@DrizzlyOwl
DrizzlyOwl / init.sh
Last active October 27, 2016 14:58
OSX Initialisation script
#!/bin/sh
echo "Installing xcode command line tools";
sudo xcode-select --install;
echo "Installing Homebrew";
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)";
brew update;
brew doctor;
@DrizzlyOwl
DrizzlyOwl / gmap.js
Last active January 5, 2016 09:14
Google map + geocode api to dynamically create a map using a provided address
!function(e,t){"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd&&define("GMaps",[],t),e.GMaps=t()}(this,function(){if("object"!=typeof window.google||!window.google.maps)throw"Google Maps API is required. Please register the following JavaScript library http://maps.google.com/maps/api/js?sensor=true.";var t=function(e,t){var o;if(e===t)return e;for(o in t)e[o]=t[o];return e},o=function(e,t){var o,n=Array.prototype.slice.call(arguments,2),r=[],s=e.length;if(Array.prototype.map&&e.map===Array.prototype.map)r=Array.prototype.map.call(e,function(e){return callback_params=n,callback_params.splice(0,0,e),t.apply(this,callback_params)});else for(o=0;s>o;o++)callback_params=n,callback_params.splice(0,0,e[o]),r.push(t.apply(this,callback_params));return r},n=function(e){var t,o=[];for(t=0;t<e.length;t++)o=o.concat(e[t]);return o},r=function(e,t){var o=e[0],n=e[1];return t&&(o=e[1],n=e[0]),new google.maps.LatLng(o,n)},s=function(e,t){var o;for(o=0;o<e.length;o++)e[o]instanceof google.ma