Skip to content

Instantly share code, notes, and snippets.

View bhubbard's full-sized avatar
:octocat:
Hello

Brandon Hubbard bhubbard

:octocat:
Hello
View GitHub Profile
#!/bin/sh
dbname=wpsample
dbuser=root
dbhost=127.0.0.1
dbpass=password
wphost=localhost
wptitle="wp-cli sample site."
wpadmin_name="dontadmin"
wpadmin_email="mail@example.com"
@getsource
getsource / heartbeat-comments.php
Last active December 21, 2015 05:08
Heartbeat Sample plugin
<?php
/*
Plugin Name: Heartbeat Comment Update
Description: Updates Comment Count on Dashboard with Heartbeat.
Author: Andrew Ozz, Mike Schroder
Version: 0.2
Author URI: http://www.getsource.net
*/
add_filter( 'heartbeat_received', 'wc_heartbeat_comment_count', 10, 3 );
@PeterBooker
PeterBooker / example.php
Last active December 21, 2015 07:19
Background Caching with Transients Example
<?php
/*
* Background Caching with Transients
* Using BBC News API as an example
*/
function pb_get_news() {
/*
* Get transient and if expired refresh data immediately
@PeterBooker
PeterBooker / pb_get_news.php
Created August 19, 2013 22:12
This functions fetches and refreshes the data if needed.
<?php
function pb_get_news() {
/*
* Get transient and if expired refresh data immediately
*/
if ( false === ( $news = get_transient( 'pb_bbc_news' ) ) ) {
// Uses BBC News API to fetch new data
@bhubbard
bhubbard / yoast-localseo-titles.markdown
Last active December 30, 2015 01:59
Here is my template for the global titles and descriptions in yoast. Quick Useful Link: http://www.quicksprout.com/the-advanced-guide-to-seo-chapter-4/

These are the default titles & descriptions I use when using the Local SEO plugin. Note this is only available and used when doing multiple locations.

#####Yoast Local SEO CPT (Default CPT Name is Locations)

Title: %%title%% %%sep%% %%cf__wpseo_business_address%% %%cf__wpseo_business_city%%, %%cf__wpseo_business_state%% %%cf__wpseo_business_zipcode%% %%cf__wpseo_business_country%% %%sep%% %%pt_single%% %%sep%% %%sitename%%

Description: %%excerpt%%

#####Yoast Local SEO CPT Archive Page (Default CPT Name is Locations)

@robneu
robneu / disable-jetpack-modules.php
Last active April 25, 2016 20:27
Disable unwanted Jetpack Modules. The whitelist array will allow any modules you want to remain enabled to continue to function. If you don't want the module to activate, remove it from the whitelist.
<?php
add_filter( 'jetpack_get_available_modules', 'prefix_hide_jetpack_modules' );
/**
* Disable all non-whitelisted jetpack modules.
*
* As it's written, this will allow all of the currently available Jetpack
* modules to work display and be activated normally.
*
* If there's a module you'd like to disable, simply comment it out or remove it
* from the whitelist and it will no longer be available for activation.
@kalenjohnson
kalenjohnson / gist:0e5805894a75bcec0204
Last active June 1, 2016 20:36
Codeship Deploy to WPEngine
REMOTE_REPOSITORY=${REMOTE_REPOSITORY:?'You need to configure the REMOTE_REPOSITORY environment variable!'}
REMOTE_BRANCH=${REMOTE_BRANCH:?'You need to configure the REMOTE_BRANCH environment variable!'}
set -e
git fetch --unshallow || true
git push ${REMOTE_REPOSITORY} ${CI_COMMIT_ID}:${REMOTE_BRANCH}
cd wp-content/themes/<theme>
npm install -g bower gulp
npm install
bower install
gulp --production
@mansooralam
mansooralam / zillowMiner.py
Created May 6, 2015 04:51
Quick helper script for mining zillow data / commute times
"""
quick script put together to scrape zillow listing data
at the very least it functions so you don't need to go back and forth to calculate commute times
very messy... maybe i'll revisit this someday
"""
import requests
import re
import csv
<?php
wp_oembed_add_provider( 'http://*.houzz.com/*', 'http://www.houzz.com/oembed' );
function do_houzz_shortcode($atts, $content=null) {
$url = substr( $atts[0], 1 );
$args = array();
if ( isset( $atts['w'] ) && is_numeric( $atts['w'] ) ) {
$args['width'] = $atts['w'];
}