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
@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';
@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
@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
@kvignos
kvignos / 01-01-outbrain-example-recirc.js
Last active November 28, 2024 02:56
WIRED Day of REST 2016 Conference Presentation - Code Snippets
// Author: Ross Patton (abbreviated by KV)
// Link to WIRED json feed
var apiUrl = 'http://' + location.host + '/wp-json/wp/v2/posts/';
// Fallback if OBR not available
if ( typeof OBR === 'undefined' ) {
$( getAll('poweredByOutbrain') ).remove();
return $.getJSON( apiUrl, function(res) {
- Setup Google Compute Account
- Create micro-f1 instance
- SSH into instance (Debian/Jessy)
- Install apt-get deps from https://github.com/eugeneware/docker-wordpress-nginx
- install fail2ban (https://www.digitalocean.com/community/tutorials/how-to-protect-an-nginx-server-with-fail2ban-on-ubuntu-14-04)
- create a wordpress rule in jails.local
```
[wordpress]
enabled = true
port = http,https
@mwpastore
mwpastore / 00README.md
Last active September 30, 2024 16:00
Lightning Fast WordPress: Caddy+Varnish+PHP-FPM

README

This gist assumes you are migrating an existing site for www.example.com — ideally WordPress — to a new server — ideally Ubuntu Server 16.04 LTS — and wish to enable HTTP/2 (backwards compatibile with HTTP/1.1) with always-on HTTPS, caching, compression, and more. Although these instructions are geared towards WordPress, they should be trivially extensible to other PHP frameworks, other FastCGI backends, and even non-FastCGI backends (using proxy in lieu of fastcgi in the terminal Caddyfile stanza).

Quickstart: Use your own naked and canonical domain names instead of example.com and www.example.com and customize the Caddyfile and VCL provided in this gist to your preferences!

These instructions target Varnish Cache 4.1, PHP-FPM 7.0, and Caddy 0.10. (I'm using MariaDB 10.1 as well, but that's not relevant to this guide.)

@hiddenpearls
hiddenpearls / pe-customize-controls.css
Created February 13, 2017 21:16 — forked from OriginalEXE/pe-customize-controls.css
Extending WordPress Customizer Panels and Sections to allow nesting
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent,
#customize-theme-controls .customize-pane-child.current-section-parent {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
}
@JacopoDaeli
JacopoDaeli / redis-dump-to-gs
Last active October 23, 2017 05:19
Backup Redis to Goolge Cloud Storage
#!/bin/bash
#### BEGIN CONFIGURATION ####
# set dates for backup rotation
NOWDATE=`date +%Y-%m-%d`
# set backup directory variables
SRCDIR='/tmp/gs_backups'
DESTDIR='redis'
@aliciaiceland
aliciaiceland / functions.php
Created May 29, 2017 11:33
Pre-populate Woocommerce checkout fields
<?php
/**
* Pre-populate Woocommerce checkout fields
*/
add_filter('woocommerce_checkout_get_value', function($input, $field ) {
global $current_user;
switch ($field) :
case 'billing_first_name':
case 'shipping_first_name':
return $current_user->first_name;
@sushyad
sushyad / gsutil_backup_setup.sh
Last active October 23, 2017 05:19
Google Cloud Storage Setup
#!/bin/bash
#this setup is based on https://scotthelme.co.uk/easy-cheap-and-secure-backup-with-google-cloud-platform
LOG_DIR=~/logs
LOCK_FILE=~/gsutil_backup_cron.lock
#everything under /data (excluding data) will be put into the target gs bucket
SOURCE_DIR=/data