Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeff Gould JRGould

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am jrgould on github.
  • I am jrgould (https://keybase.io/jrgould) on keybase.
  • I have a public key whose fingerprint is 645F E088 E027 D8A5 18DA 3C93 FA2D 17A4 2714 613A

To claim this, I am signing this object:

View wp-migrate-db-pro-skip-serialized-refs.php
<?php
/*
Plugin Name: WP Migrate DB Pro Tweak: Skip Serialized Refs in Options Table
Plugin URI: http://github.com/deliciousbrains/wp-migrate-db-pro-tweaks
Description: Skip unserializing / replacing data that contains serialized references as this can cause an infinite loop.
Author: Delicious Brains
Version: 1
Author URI: http://deliciousbrains.com
*/
View wp-migrate-db-pro-skip-options.php
<?php
/*
Plugin Name: WP Migrate DB Pro Tweak: Skip Options
Plugin URI: http://github.com/deliciousbrains/wp-migrate-db-pro-tweaks
Description:
Author: Delicious Brains
Version: 1
Author URI: http://deliciousbrains.com
*/
@JRGould
JRGould / wp-parse-url-mu-plugin.php
Created Nov 28, 2017
Place this file in wp-content/mu-plugins/ to patch missing wp_parse_url() function
View wp-parse-url-mu-plugin.php
<?php
if( ! function_exists( 'wp_parse_url' ) ) {
function wp_parse_url( $url, $component = -1 ) {
$to_unset = array();
$url = strval( $url );
if ( '//' === substr( $url, 0, 2 ) ) {
$to_unset[] = 'scheme';
$url = 'placeholder:' . $url;
} elseif ( '/' === substr( $url, 0, 1 ) ) {
View backup-all-dbs.sh
#!/bin/bash
export TERM=xterm;
clear;
echo " ";
echo "---------------------------------------------";
echo " START | "$(date +%m.%d.%Y-%H.%M.%S);
echo "---------------------------------------------";
#create db dump for all databases
View wpmdb-fix-expect-header.php
<?php
/*
Plugin Name: WPMDB - Fix cURL Expect Header
Plugin URI: https://gist.github.com/JRGould/bd4e23a40111f5f3cd69b6913e05de00/
Description: Preempts automatic inclusion of "Expect: 100-continue" header by cURL which can cause null response from remote site, resulting in "cURL Error 52: Empty reply from server."
Author: Delicious Brains
Author URI: http://deliciousbrains.com
Version: 0.1
Network: True
*/
@JRGould
JRGould / SharedDataSingleton.swift
Last active Apr 19, 2017
Swift shared data singleton with data persistence and simple callback support
View SharedDataSingleton.swift
/**
Usage: var mySharedData = SharedData.instance
*/
class SharedData {
static let instance: SharedData = {
let instance = SharedData()
// Update instance.defaultsName if desired
if let defaults = NSUserDefaults.standardUserDefaults().objectForKey(instance.defaultsName) as? [String:AnyObject] {
View wpmdbpro-migration-complete-notifications.php
<?php
/*
Plugin Name: WPMDB Pro Migration Complete Notifications
Plugin URI: http://deliciousbrains.com
Description: Get notified when a migration completes
Author: Delicious Brains
Version: 0.0
Author URI: http://deliciousbrains.com
*/
@JRGould
JRGould / give-it-a-rest-plugin.php
Last active Aug 2, 2016
Give it a REST WordPress plugin component
View give-it-a-rest-plugin.php
<?php
/*
Plugin Name: Give It A REST API Plugin
Plugin URI: http://deliciousbrains.com/blog
Description: Enables the Give it a REST API
Author: Jeff Gould
Version: 0.1
Author URI: http://deliciousbrains.com
*/
@JRGould
JRGould / app.js
Created Nov 26, 2015
Give it a REST app using data from give-it-a-rest.dev
View app.js
var giar_settings = {
api_base: 'http://give-it-a-rest.dev/wp-json/give-it-a-rest/v1/',
endpoints: {
posts: { route: 'list-posts/', method: 'GET' },
vote: { route: 'vote/', method: 'POST' }
}
}
var $el;
var posts = {};