Skip to content

Instantly share code, notes, and snippets.

Jeff Gould JRGould

Block or report user

Report or block JRGould

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 = {};
@JRGould
JRGould / app.js
Last active Nov 26, 2015
Give it a REST js using mock data
View app.js
var posts_mockup = [
{ ID: 1, title: "First Post Title", permalink: 'http://example.com/1/', upvotes: 12, downvotes: 2 },
{ ID: 22, title: "Second Post Title", permalink: 'http://example.com/2/', upvotes: 1, downvotes: 22 },
{ ID: 33, title: "Third Post Title", permalink: 'http://example.com/3/', upvotes: 5, downvotes: 4 },
{ ID: 44, title: "Fourth Post Title", permalink: 'http://example.com/4/', upvotes: 2, downvotes: 2 },
{ ID: 55, title: "Fifth Post Title", permalink: 'http://example.com/5/', upvotes: 8, downvotes: 13 },
];
var $el;
var posts = {};
You can’t perform that action at this time.