Skip to content

Instantly share code, notes, and snippets.

View borkweb's full-sized avatar

Matthew Batchelder borkweb

View GitHub Profile
@borkweb
borkweb / cli-db.sh
Last active September 14, 2022 02:29
How I set up the wp-cli testing environment with docker
#!/bin/bash
container="wp-cli-mysql"
container_status=$( docker container inspect -f '{{.State.Status}}' $container );
echo "Setting environment variables"
export WP_CLI_TEST_DBHOST=127.0.0.1:3310
export WP_CLI_TEST_DBROOTUSER=root
export WP_CLI_TEST_DBROOTPASS=password
export WP_CLI_TEST_DBNAME=wp_cli_test
@borkweb
borkweb / wacom
Created August 20, 2020 03:09
Script for setting up my wacom on linux using xsetwacom
#!/usr/bin/env php
<?php
$command = 'xsetwacom --set "%s" MapToOutput 3840x2160+1920+0';
$output = shell_exec( 'xsetwacom --list devices' );
$output = explode( "\n", $output );
// Parts will include:
// STYLUS
@borkweb
borkweb / .gitconfig
Created July 29, 2020 19:51
My aliases for git
[alias]
# === Common Commands ===
a = add # Shortcut for add
br = branch # Shortcut for br
branches = branch -a # Shortcut for branch -a
co = checkout # Shortcut for checkout
cob = checkout -b # Shortcut for checkout -b
cp = cherry-pick # Shortcut for cherry-pick
po = push origin # Shortcut for push origin
@borkweb
borkweb / Example Item
Created October 6, 2018 05:05
(MediaWiki) Example Item
{{Item
|image=
|name=Amulet of Agility
|cabal=
|location=
|storable=
|dests=
|cost=
|sell=1000
|type=Amulet
@borkweb
borkweb / Template:Item
Created October 6, 2018 05:03
(MediaWiki) Template:Item
{| width="250" align="right" class="info-box item"
|-
{{#if: {{{image|}}}|
{{!}} colspan="2" class="info-image" {{!}} {{{image}}}}}
|-
| colspan="2" class="info-name" | '''{{{name}}}'''
|-
| colspan="2" class="info" | '''General Information'''
|-
@borkweb
borkweb / Template:Area
Created October 6, 2018 04:59
(MediaWiki) Template:Area
{| width="250" align="right" class="info-box area"
|-
{{#if: {{{image|}}}|
{{!}} colspan="2" class="info-image" {{!}} {{{image}}}}}
|-
| colspan="2" class="info-name" | '''{{{name}}}'''
|-
| colspan="2" class="info" | '''General Information'''
|-
@borkweb
borkweb / Template:Clear
Created October 6, 2018 04:57
(MediaWiki) Template:Clear
<div style="clear:both"></div>
@borkweb
borkweb / template:!
Created October 6, 2018 04:55
Template:!
|
<?php
function convert_recurring_event_meta() {
global $wpdb;
// Get meta values
$event_recurrence_meta = $wpdb->get_results("
SELECT post_id, meta_value
FROM $wpdb->postmeta
WHERE meta_key = '_EventRecurrence'
// Calculate hours for any type of ticket in the next release
(function( $ ) {
var total = 0;
$('.estimated_hours').each(function() {
var $el = $( this );
var $row = $el.closest( 'tr' );
var $version = $row.find( '.fixed_version a' );
if ( 'Next Release' !== $.trim( $version.html() ) ) return;