Skip to content

Instantly share code, notes, and snippets.

View joelataylor's full-sized avatar

Joel Taylor joelataylor

View GitHub Profile
@joelataylor
joelataylor / change-wp-urls.sql
Created December 29, 2014 14:24
Change WP URLs
#Fix WP URLs
SET @oldurl = 'http://staging.windfarmstudios.net';
SET @newurl = 'http://staging.wubdfarnstyduis.com';
UPDATE wm_wp_options SET option_value = REPLACE(option_value, @oldurl, @newurl);
UPDATE wm_wp_posts SET guid = REPLACE (guid, @oldurl, @newurl);
UPDATE wm_wp_posts SET post_content = REPLACE (post_content, @oldurl, @newurl);
@joelataylor
joelataylor / gist:b3d6977a48c257e544dc
Created July 9, 2014 03:24
WP - change upload dir based on post_type
// Save uploads for Products to a products subdir & Artists to an Artist dir
function reroute_upload_dir ( $pathdata ) {
$post_type = ( isset( $_POST['post_id'] ) ) ? get_post_type( $_POST['post_id'] ) : false;
if ( $post_type == 'product' ) {
$subdir = '/products';
} elseif ( $post_type == 'artists' ) {
$subdir = '/artists';
} elseif ( $post_type === 'post' ) {
<html>
<head>
<title>Stripe Fun</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<script type="text/javascript">
Stripe.setPublishableKey('pk_2V6rBH5IilzAezJ8K9fcpOkYT7VJf');
jQuery(function($) {
$('#payment-form').submit(function(event) {
var $form = $(this);
@joelataylor
joelataylor / Sublime Shortcuts
Created February 28, 2013 03:27
Sublime Shortcuts
Align Equals: Command + Control + a
@joelataylor
joelataylor / convert_mp3.sh
Created November 6, 2012 21:37
Convert mp3 w/ FFmpeg
printf '\nTOKEN: %s\n' "$auth_token"
printf 'STORAGE: %s\n\n' "$storage_url"
store="need_encoding.log"
comm -23 <(swift list "audio-in" | sed 's/.mp3//') <(swift list "audio-out" | sed 's/.ogg//') > "$store"
counter=0
total=$(wc -l <"$store")
while read -r line; do
((counter++))
@joelataylor
joelataylor / gist:3746288
Created September 18, 2012 22:16
Remove small files
#!/bin/bash
# The goal of this script is to delete any files under 1mb (1048576 bytes)
while read -r file; do
length=$(swift stat audio-in "$file" | grep 'Content Length' | sed 's/Content Length: //')
#echo "Length is: $length"
if (( length < 1048576 )) ; then
swift delete audio-in "$file"
#echo "deleting $file"
@joelataylor
joelataylor / gist:3702984
Created September 11, 2012 23:27
swift commands
#!/bin/bash
# The goal of this script is to remove mp3's that have already been processed
temp_file='/tmp/music-dup.txt'
comm -12 <(swift list 'audio-in' | sed 's/.mp3//') <(swift list 'audio-out' | sed 's/.ogg//') > $temp_file
while read -r line; do
echo "removing item: $line.mp3"