Skip to content

Instantly share code, notes, and snippets.

View AaronHolbrook's full-sized avatar
👋

Aaron Holbrook AaronHolbrook

👋
View GitHub Profile
@AaronHolbrook
AaronHolbrook / composer.json
Created January 23, 2018 15:20
Composer lock file for WP CLI Issue #4632
{
"config": {
"preferred-install": "dist",
"vendor-dir": "mu-plugins/app/vendor"
},
"extra": {
"installer-paths": {
"mu-plugins/{$name}/": [
"type:wordpress-muplugin"
]
@AaronHolbrook
AaronHolbrook / app.php
Created January 23, 2018 12:46
WP CLI composer autoload bug
<?php
require_once __DIR__ . '/vendor/autoload.php';
/**
* Load dotenv if .env file is present
*/
if ( file_exists( __DIR__ . '/.env.php' ) ) {
Arrilot\DotEnv\DotEnv::load( __DIR__ . '/.env.php' );
}
@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',
@AaronHolbrook
AaronHolbrook / backbone-vs-react.md
Last active August 29, 2015 14:05
Backbone vs React brainstorm

React.js

Pros:

  • handles data binding & templating
  • dynamic updating of view - only changes what's required, intelligent, throttled updating

Cons:

  • can't load JSX file and read/render from PHP
  • requires odd JSX JS template files
  • relatively young, immature framework
@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'
* }
* };
@AaronHolbrook
AaronHolbrook / js-rand-test.js
Created July 29, 2014 20:40
Testing JS's random number distribution
// repl.it test: http://repl.it/WDj/
var keys = ["0", "1", "2"]
var keyCount = {
0: 0,
1: 0,
2: 0
};
function randGen( randArray ) {
@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
@AaronHolbrook
AaronHolbrook / grep search.bash
Created December 31, 2012 23:13
search files and contents of files for string (ignore case, recursive search)
grep -iR 'slider-script.js' ./*
@AaronHolbrook
AaronHolbrook / .gitconfig
Created August 24, 2012 17:24
git lg alias for pretty log
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
st = status -sb