Skip to content

Instantly share code, notes, and snippets.

View AaronHolbrook's full-sized avatar
👋

Aaron Holbrook AaronHolbrook

👋
View GitHub Profile
@szbl
szbl / get-terms-for-post-type.php
Created July 17, 2012 05:10
get_terms_for_post_type()
<?php
//
// Assumption: we have two post types, "books" and "videos" and a shared hierarchical taxonomy called "library-section"
//
/*
* Pulls all non-empty terms for a given post type.
*
* @param $taxonomy The name of the taxonomy, e.g. "library-section"
* @param $post_type The name of the post type, e.g. "book"
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active April 17, 2024 12:35
Using Git with Subversion Mirroring for WordPress Plugin Development
@AaronHolbrook
AaronHolbrook / Make list of all WordPress functions.sh
Last active December 10, 2015 23:39
Curls in the Function reference page from WordPress.org, strips everything except the function name. For future use in building Sublime plugin for function lookups.
curl -s http://codex.wordpress.org/Function_Reference | grep -C 0 "title=\"Function Reference" | sed 's/.*:.*Function Reference\/.*">//' | sed 's/<.*>//' | sed 's/(.*)//' > wp-functions.txt
@jeremyfelt
jeremyfelt / proxy-production.conf
Last active May 14, 2019 18:02
Nginx configuration to proxy 404 files locally to a production domain
# Adjust this to include any other necessary files.
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
try_files $uri $uri/ @production;
}
location @production {
resolver 1.1.1.1;
proxy_pass http://{replace-with.domain.com}/$uri;
#!/bin/bash
function clean_dir() {
files_to_remove=`ls | grep -v 'composer\.json'`
if [[ "$files_to_remove" ]]; then
rm -r $files_to_remove > /dev/null 2>&1
fi
}
LOCK_FILE='/tmp/updating_wordpress'
@AaronHolbrook
AaronHolbrook / safeRead.js
Created August 6, 2014 19:06
Safely read any number of properties from a JSON object
/**
* Safe read to check any amount of properties are safe to traverse
* From: http://thecodeabode.blogspot.com.au/2013/04/javascript-safely-reading-nested.html
*
* Usage... for a nested structure
* var test = {
* nested: {
* value: 'Read Correctly'
* }
* };
@Rarst
Rarst / WordPress.xml
Last active August 5, 2021 04:14
WordPress Live Templates for PhpStorm
<?xml version="1.0" encoding="UTF-8"?>
<templateSet group="WordPress">
<template name="aa" value="add_action( '$hook$', '$callback$' );&#10;$END$" description="add_action" toReformat="false" toShortenFQNames="true">
<variable name="hook" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="callback" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
@Rarst
Rarst / GPLv2.php
Last active April 20, 2019 08:08
WordPress File Templates for PhpStorm.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@joshlevinson
joshlevinson / .bash_profile
Last active April 21, 2023 12:04
WP CLI + Xdebug
# Add this to /config/bash_profile
function wpd {
export XDEBUG_CONFIG="idekey=VVVDEBUG remote_connect_back=1"
wp "$@"
unset XDEBUG_CONFIG
};
# Run these commands:
# vagrant ssh
# sudo cp /srv/config/bash_profile /home/vagrant/.bash_profile
# source ~/.bash_profile
@AaronHolbrook
AaronHolbrook / jetpack-disable-tools.php
Last active February 2, 2016 12:21
Disable jetpack tools
<?php
/**
* Disable certain tools in jetpack that can cause issues
*/
add_filter( 'jetpack-tools-to-include', function( $tools ) {
$disabled_array = [
'theme-tools/random-redirect.php',
'holiday-snow.php',