Skip to content

Instantly share code, notes, and snippets.

@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@danielbachhuber
danielbachhuber / gist:9379135
Created March 5, 2014 23:43
Fix network admin URL to include the "/wp/" base
<?php
/**
* Fix network admin URL to include the "/wp/" base
*
* @see https://core.trac.wordpress.org/ticket/23221
*/
add_filter( 'network_site_url', function( $url, $path, $scheme ){
$urls_to_fix = array(
'/wp-admin/network/',
/*!
* jQuery JavaScript Library v2.1.1pre
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 10, 2025 09:21
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

<?php
echo '<tr class="addon-file-field">';
echo '<th>';
echo '<label for="addon-file">'.__( 'ZIP file', '' ).'</label>';
echo '</th>';
echo '<td>';
echo '<input type="text" name="addon-meta[file]" id="addon-file" class="widefat" value="'.esc_url( $file ).'">';
echo '</td>';
echo '</tr>';
@tomjn
tomjn / composer.json
Last active January 3, 2016 13:49
Fixes oEmbedding tweets after Twitter's changes in Jan 2014. To use, download by clicking the "Download Gist" button below, upload to your WordPress site and activate. You will then need to re-save any posts edited or published since the 17 January.
{
"name": "cftp/twitteroembed-hotfix",
"description": "Fixes oEmbedding tweets after Twitter's changes in Jan 2014",
"license": "GPL-2.0+",
"type": "wordpress-plugin",
"authors": [
{
"name": "Tom J Nowell",
"email": "[email protected]",
"homepage": "http://tomjn.com"
@norcross
norcross / norcross-debug-functions.php
Last active March 29, 2021 20:51
my list of debugging functions to keep in an MU file
<?php
/*
Plugin Name: Norcross Debug Functions
Plugin URI: https://gist.github.com/norcross/7864205/
Description: A set of functions I use on all sites while building
Author: Andrew Norcross
Version: 0.0.1
Requires at least: 3.0
Author URI: http://andrewnorcross.com
*/
@strangerstudios
strangerstudios / logged-out-view.php
Created November 7, 2013 16:36
Add ?loggedoutview=1 to the end of any URL to see what it looks like for logged out users.
<?php
/*
Plugin Name: Logged Out View
Plugin URI: http://www.strangerstudios.com/wp/logged-out-view/
Description: Add ?loggedoutview=1 to the end of any URL to see what it looks like for logged out users.
Author: Stranger Studios
Version: .1
Author URI: http://www.strangerstudios.com
*/
@pento
pento / backup-scheduler.php
Last active December 27, 2015 12:59
Backup scheduler for WordPress Automatic Updates
<?php
function my_backup_scheduler( $event ) {
// 'wp_maybe_auto_update' is the cron hook for the auto update process
if ( 'wp_maybe_auto_update' !== $event['hook'] )
return;
wp_schedule_single_event( $event['timestamp'] - 5 * MINUTE_IN_SECONDS, 'my_backup' );
}
add_filter( 'schedule_event', 'my_backup_scheduler', 10, 1 );