Skip to content

Instantly share code, notes, and snippets.

iandunn /
Created Jun 5, 2017
Alias to convert a stereo recording to mono
# Alias to convert a stereo recording to mono
# $1 - The input filename
function qtmono {
basename=$(basename "$1")
ffmpeg -i $1 -codec:v copy -af pan="mono: c0=FL" $filename-mono.$extension
iandunn / test-nearby-events.php
Last active May 11, 2017
mu-plugin to test nearby events
View test-nearby-events.php
// type "error" into the city name field to simulate an HTTP request error
function nearbywp_trigger_error( $request, $request_args, $request_url ) {
$url_params = explode( '&', parse_url( $request_url, PHP_URL_QUERY ) );
if ( in_array( 'location=error', $url_params ) ) {
$request = new WP_Error( 'test', 'testing error condition' );
iandunn / nearby-events.diff
Last active May 9, 2017
nearby events merge patch
View nearby-events.diff
moved to
iandunn / remove-red-notification-dot-from-trello-favicon.js
Last active Jan 20, 2017
Remove Red Notification Dot from Trello Favicon
View remove-red-notification-dot-from-trello-favicon.js
// ==UserScript==
// @name Remove Red Notification Dot From Trello Favicon
// @namespace
// @version 0.1
// @description Trello adds a red dot to their favicon when new notifications are available, which I find useless and distracting. This restores the original icon after a few seconds, so that you normally see the favicon without the dot.
// @author Ian Dunn
// @match*
// @grant none
// ==/UserScript==
iandunn / phpmailer-send-via-mail.php
Created Aug 17, 2016
Disable PHPMailer sending via SMTP, so that MailCatcher can catch outbound messages from dev environments
View phpmailer-send-via-mail.php
* Configure PHPMailer to send via PHP's mail()
* @param PHPMailer $phpmailer
function phpmailer_send_via_mail( $phpmailer ) {
add_action( 'phpmailer_init', 'phpmailer_send_via_mail', 999 );
View phpdoc-parser-install-error.log
vagrant @ vvv in /srv/www/wordpress-meta-environment/
> git clone
Cloning into 'phpdoc-parser'...
Warning: Permanently added the RSA host key for IP address '' to the list of known hosts.
remote: Counting objects: 1860, done.
remote: Total 1860 (delta 0), reused 0 (delta 0), pack-reused 1860
Receiving objects: 100% (1860/1860), 1.00 MiB | 169.00 KiB/s, done.
Resolving deltas: 100% (994/994), done.
Checking connectivity... done.
iandunn /
Created Jul 28, 2016
Avoid having to enter a password when you just want to `svn up`
# Avoid having to enter a password when you just want to `svn up`
function svn() {
local args=($@)
local rest=(${args[@]:1:${#args[@]}})
local SVN="/usr/bin/svn"
case $1 in
source /root/config/environment-variables
/bin/bash -c "$SVN --no-auth-cache --username $SVNUSER --password $SVNPASS up $rest"
iandunn / plugin-active-on-sites.php
Last active Jul 29, 2016
WP-CLI command to list all sites in a Multisite network that have activated the given plugin.
View plugin-active-on-sites.php
* This is now available as a WP-CLI package:
* wp package install iandunn/wp-cli-plugin-active-on-sites
* wp plugin active-on-sites <plugin_slug>
* See
View deployer-relative-symlinks.php
iandunn / log-wp-rest-api-errors.php
Last active Feb 27, 2019
Log WordPress REST API errors
View log-wp-rest-api-errors.php
* Log REST API errors
* @param WP_REST_Response $result Result that will be sent to the client.
* @param WP_REST_Server $server The API server instance.
* @param WP_REST_Request $request The request used to generate the response.
function log_rest_api_errors( $result, $server, $request ) {