Skip to content

Instantly share code, notes, and snippets.

View octalmage's full-sized avatar

Jason Stallings octalmage

View GitHub Profile
begin remote
name Harmony_655
bits 13
flags RC5|CONST_LENGTH
eps 30
aeps 100
one 935 836
zero 935 836
@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().
@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 / custom_timeout.php
Created July 14, 2016 18:38
PHP Compatibility Custom Timeout
<?php
/*
Plugin Name: PHP Compatibility Custom Timeout
*/
function custom_timeout( $timeout ) {
return 0;
}
add_filter( 'wpephpcompat_scan_timeout', 'custom_timeout', 10 );
@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 / 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 / roles.md
Last active May 14, 2023 17:43
Default WordPress user roles and capabilities.

WordPress v4.3.1

Admin wp_capabilities wp_user_level 10

a:1:{s:13:"administrator";b:1;}

Contributor wp_capabilities wp_user_level 1

@octalmage
octalmage / clearcart.php
Created October 26, 2015 07:00
Force clear WooCommerce cart for WordPress user.
<?php
add_action( 'init', 'force_clear_woocommerce_cart' );
function force_clear_woocommerce_cart()
{
$user_ID = get_current_user_id();
if ($user_ID === 68364)
{
@octalmage
octalmage / sine.js
Created October 18, 2015 14:55
RobotJS - Move the mouse across the screen as a sine wave.
//Move the mouse across the screen as a sine wave.
var robot = require("robotjs");
//Speed up the mouse.
robot.setMouseDelay(2);
var twoPI = Math.PI * 2.0;
var screenSize = robot.getScreenSize();
var height = (screenSize.height / 2) - 40;
var width = screenSize.width;