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
@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
@nickkuijpers
nickkuijpers / gist:5d07ecf9b0a0678b4f4c
Created April 17, 2015 15:21
WooCommerce Bootstrap Checkout Form
add_filter('woocommerce_checkout_fields', 'addBootstrapToCheckoutFields' );
function addBootstrapToCheckoutFields($fields) {
foreach ($fields as &$fieldset) {
foreach ($fieldset as &$field) {
// if you want to add the form-group class around the label and the input
$field['class'][] = 'form-group';
// add form-control to the actual input
$field['input_class'][] = 'form-control';
@tomazzaman
tomazzaman / class-developer-import.php
Created March 31, 2015 18:03
Import JSON into WordPress
<?php
// Published under GPL
// tutorial here: https://codeable.io/community/how-to-import-json-into-wordpress/
class Developer_Import {
public function __construct() {
add_action( 'wp_ajax_import_developer', array( $this, 'import_developer' ) );
@chrisblakley
chrisblakley / server-side-ga-events.php
Last active September 18, 2024 13:10
PHP functions to send data to Google Analytics
//Parse the GA Cookie
function gaParseCookie() {
if (isset($_COOKIE['_ga'])) {
list($version, $domainDepth, $cid1, $cid2) = explode('.', $_COOKIE["_ga"], 4);
$contents = array('version' => $version, 'domainDepth' => $domainDepth, 'cid' => $cid1 . '.' . $cid2);
$cid = $contents['cid'];
} else {
$cid = gaGenerateUUID();
}
return $cid;
@slickplaid
slickplaid / zillowEstimate.js
Last active January 16, 2020 05:25
Get Zillow Estimate and Image from Zillow's API, Quick and Dirty
/* Quick and dirty, should be wrapped better but this is just a demo */
var app = app || {};
app.apikeys = app.apikeys || {};
app.urls = app.urls || {};
app.methods = app.methods || {};
app.apikeys.zillow = 'YOUR API KEY HERE';
app.urls.zillow = {
<?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'];
}
@derekconjar
derekconjar / wordpress-firebase.php
Last active April 25, 2024 15:21
An example of using Firebase and WordPress together. The idea is to use WP's custom post types and metaboxes to make content management easy, and sync with Firebase so that your websites have access to a real-time JSON feed of your custom data.
<?php
/**
* All custom functions should be defined in this class
* and tied to WP hooks/filters w/in the constructor method
*/
class Custom_Functions {
// Custom metaboxes and fields configuration
@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.
@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