Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am aaroneaton on github.
  • I am aaroneaton (https://keybase.io/aaroneaton) on keybase.
  • I have a public key whose fingerprint is D1D5 4ACA C40F E038 52C3 4307 F38C 5B43 ED0A E121

To claim this, I am signing this object:

@aaroneaton
aaroneaton / composer.json
Last active May 13, 2018 00:55
Include the WordPress unit tests as a Composer package
"repositories": [
{
"type" : "package",
"package": {
"name": "wordpress/unit-tests",
"version": "1.0",
"source" : {
"type": "svn",
"url": "http://unit-tests.svn.wordpress.org",
"reference": "trunk"
@aaroneaton
aaroneaton / network-shared-media.php
Created September 13, 2011 14:32
WP:Share WP media libraries across multisite network
<?php
// Add filter that inserts our new tab
function nsm_menu($tabs) {
$newtab = array('shared_media' => __('Network Shared Media', 'networksharedmedia'));
return array_merge($tabs, $newtab);
}
add_filter('media_upload_tabs', 'nsm_menu');
// Load media_nsm_process() into the existing iframe
function nsm_menu_handle() {
class MyComponent extends React.Component {
...
render() {
return (
<div className="parent">
<div className="child" ref={el => this.targetEl = el}>Content Here</div>
</div>
)
}
...
@aaroneaton
aaroneaton / Navigation.php
Last active March 7, 2017 19:10
Using the Zurb Foundation Top Bar with WordPress menus
<?php
class Navigation {
public function __construct() {
// Move the navigation to the header element
remove_action( 'genesis_after_header', 'genesis_do_nav' );
remove_action( 'genesis_site_title', 'genesis_seo_site_title' );
// remove_action( 'genesis_header', )
@aaroneaton
aaroneaton / vvv-init.sh
Created March 1, 2015 22:23
site setup
# Init script for your neat site
echo "Commencing My Neat Site Setup"
# Make a database, if we don't already have one
# You can change the table name to anything you like
echo "Creating database (if it's not already there)"
mysql -u root --password=root -e "CREATE DATABASE IF NOT EXISTS my_neat_site"
mysql -u root --password=root -e "GRANT ALL PRIVILEGES ON my_neat_site.* TO wp@localhost IDENTIFIED BY 'wp';"
@aaroneaton
aaroneaton / disable-comments.php
Created January 4, 2017 02:52
Disables comments on all pages
<?php // Remove this line
// Disable comments on all pages
add_action( 'init', function() {
remove_post_type_support( 'page', 'comments' );
}, 100 );
@aaroneaton
aaroneaton / provision-post.sh
Last active November 2, 2016 08:01
Setup themes & plugins after VVV provision
# Get rid of the default crap
wp site empty --yes
# Remove Hello Dolly (sorry Matt)
wp plugin uninstall hello
# Install Genesis framework
wp theme install <super-secret-url-for-genesis>
# Install plugins available in repo
@aaroneaton
aaroneaton / phpspec-setup.php
Last active September 16, 2016 02:58
Using WP_Mock with PhpSpec
<?php
class TodoSpec extends ObjectBehavior {
public function let() {
\WP_Mock::setUp();
}
public function letGo() {
\WP_Mock::tearDown();
}
@aaroneaton
aaroneaton / gist:3955554
Last active January 5, 2016 15:46
AppleScript:Do Not Disturb on Microsoft Link
-- Save the foreground application
tell application "System Events"
set currentApp to name of 1st process whose frontmost is true
end tell
-- Get Lync in the foreground so we can use the menu
tell application "Microsoft Lync"
activate
end tell