Skip to content

Instantly share code, notes, and snippets.

View octalmage's full-sized avatar

Jason Stallings octalmage

View GitHub Profile
@octalmage
octalmage / .travis.yml
Created September 29, 2015 19:14
RobotJS Travis config for Node.js v4.
sudo: false
env:
- CXX=g++-4.8
language: node_js
node_js:
- 0.10
- 0.12
- 4.0.0
- iojs-v2
@octalmage
octalmage / send-reads-to-master.php
Last active November 23, 2015 15:19
HyperDB - Send Reads to Master.
<?php
/**
* Plugin Name: Send Reads to Master
* Description: Suggested fix for backend replication lag
* Author: WP Engine
* Version: 0.2
*
*/
if ( is_admin() ) {
### Keybase proof
I hereby claim:
* I am octalmage on github.
* I am octalmage (https://keybase.io/octalmage) on keybase.
* I have a public key whose fingerprint is D1E3 8523 50B8 CF90 3CC3 6E8B 6D42 2240 A4B5 E3F4
To claim this, I am signing this object:
@octalmage
octalmage / purge-object-cache.php
Created June 14, 2016 19:39
Automatically purge object cache
<?php
/*
Plugin Name: Automatically purge object cache
Description: Automatically purge object cache on post changes.
*/
foreach ( array( 'trashed_post', 'delete_post', 'edit_post', 'publish_page', 'publish_post', 'save_post' ) as $hook ) {
add_action( $hook, 'wp_cache_flush' );
}
@octalmage
octalmage / example.md
Created July 13, 2016 16:14 — forked from lee-dohm/example.md
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot of noisy logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<spoilers>
 <summary>Summary Goes Here</summary>
@octalmage
octalmage / fix-login-403.php
Last active September 15, 2016 10:03
This fixes 403s for ajax login plugins.
<?php
/**
* Plugin Name: Fix Ajax Login on WP Engine.
* Description: Removes the wpe_login_failed_403 action.
* Version: 0.1
* Author: Jason Stallings
*/
// Prevent direct access to this file
if ( ! defined( 'ABSPATH' ) ) {
@octalmage
octalmage / spamhipchat.applescript
Last active January 18, 2017 16:25
Spam Hipchat.
delay 10
repeat 100 times
activate application "HipChat"
tell application "System Events" to keystroke "(parrot) (aussieparrot)"
tell application "System Events" to key code 76
delay 30
end repeat
@octalmage
octalmage / if_no_title.php
Created February 28, 2017 15:33
Modify the edit.php screen to show post excerpts if there is no title.
<?php
/*
Plugin Name: If No Title
Description: Modify the edit.php screen to show post excerpts if there is no title.
Version: 0.0.1
*/
add_action( 'load-edit.php', function()
{
add_filter( 'the_title', function( $title )
@octalmage
octalmage / bulkUpdate.js
Created May 21, 2017 15:47 — forked from davideast/bulkUpdate.js
Bulk update with .push()
/**
* Send a bulk update to Firebase from an array or an object literal.
*
* When .push() is called on a Firebase reference without a parameter passed no
* trip to the server is made.
*
* ex:
* var childRef = ref.push();
*
* A reference is returned which has a push-id that can be returned by calling .name().
@octalmage
octalmage / bulkUpdate.js
Created May 21, 2017 15:47 — forked from davideast/bulkUpdate.js
Bulk update with .push()
/**
* Send a bulk update to Firebase from an array or an object literal.
*
* When .push() is called on a Firebase reference without a parameter passed no
* trip to the server is made.
*
* ex:
* var childRef = ref.push();
*
* A reference is returned which has a push-id that can be returned by calling .name().