Skip to content

Instantly share code, notes, and snippets.

View borkweb's full-sized avatar

Matthew Batchelder borkweb

View GitHub Profile
@borkweb
borkweb / mtup
Last active August 29, 2015 14:21
#!/bin/bash
#########################
# This bash script pulls the latest plugin code for whichever branch is checked out
#
# Optionally checks out a branch before pulling.
#
# Example: mtup develop
#########################
<?php
function absint( $maybeint ) {
return abs( intval( $maybeint ) );
}
function sanitize_absint( $number = null ){
// If it's not numeric we forget about it
if ( ! is_numeric( $number ) ){
return false;
}
// ==UserScript==
// @name Modern Tribe navigation
// @namespace central.tri.be
// @version 0.1
// @description Adds custom navigation to GitHub and Central
// @author Matthew Batchelder
// @match https://github.com
// @include /^https:\/\/github.com\/.*/
// @include /^https:\/\/central.tri.be(\/.*)?/
// @grant none
<?php
$loops = 1000000;
$a = array();
$b = array();
for ($i = 0; $i < $loops; $i++) {
$a[] = $i;
$b["item{$i}"] = $i;
}
<?php
$loops = 1000000;
$start = microtime( TRUE );
for ( $i = 0; $i < $loops; $i++ ) {
$thing = (object) array(
'cat' => (object) array(
'name' => 'Mr. Giggles',
'age' => 3,

I would assume that test data would be localized via wp_localize_script so the test data is fully available on page load. Here's what I'd imagine the enqueues to be:

wp_localize_script( 'go-ab-testing', 'go_ab_testing', array( 'tests' => $variations ) );
wp_enqueue_script( 'go-ab-testing' );
if ( 'undefined' == typeof go_ab_testing ) {
	var go_ab_testing = {};
<?php
set_time_limit( -1 );
error_reporting( E_ERROR );
if ( function_exists( 'xdebug_disable' ) ) {
xdebug_disable();
}//end if
$dir_child = '/var/www/wp/wp-content/themes/vip/gigaom5';
$plugins = '/var/www/pro/application/content/plugins';
@borkweb
borkweb / saber-uploads
Last active January 1, 2016 06:39
Automate the uploading of sabers to the Dark Jedi Brotherhood site so I don't have to do each one manually.
set saber to "Club"
set sabertrims to {"Plain", "Consular", "Guardian", "Krath", "Obelisk", "Sentinel", "Sith"}
set sabercolors to {"Blue", "Green", "Light Blue", "Purple", "Red", "Yellow"}
set sabertrims to {"Plain"}
set sabercolors to {"Pink", "Puce"}
set saberrequirements to {{"Rank", "13"}}
set theUrl to "https://www.darkjedibrotherhood.com/admin/sabers/new"
@borkweb
borkweb / photoshop-saber-mutations.js
Last active February 27, 2021 18:59
Photoshop Script for saving lightsaber mutations with Actions
/**
* Save lightsaber mutations to different files
* Created by: Matthew Batchelder (Orv Dessrx)
* For: Dark Jedi Brotherhood https://www.darkjedibrotherhood.com
*/
if ( 0 !== app.documents.length ) {
var doc = app.documents[0];
var filename = doc.name.substring( 0, doc.name.indexOf( '.' ) );
var file;