Skip to content

Instantly share code, notes, and snippets.

View joelataylor's full-sized avatar

Joel Taylor joelataylor

View GitHub Profile
@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"
@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 / 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 / Sublime Shortcuts
Created February 28, 2013 03:27
Sublime Shortcuts
Align Equals: Command + Control + a
<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 / 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' ) {
@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 / adg-htaccess
Created January 26, 2015 00:17
ADG htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Redirect to https (this causes an infinite loop??)
#RewriteCond %{HTTPS} !^on$
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
# Redirect old product urls
<select name="rollbar_logging_level">
<option value="1" <?php echo rollbar_get_error_level_match($current_val, 1); ?>>Fatal run-time errors (E_ERROR) only</option>
<option value="2" <?php echo rollbar_get_error_level_match($current_val, 2); ?>>Run-time warnings (E_WARNING) and above</option>
<option value="4" <?php echo rollbar_get_error_level_match($current_val, 4); ?>>Compile-time parse errors (E_PARSE) and above</option>
<option value="8" <?php echo rollbar_get_error_level_match($current_val, 8); ?>>Run-time notices (E_NOTICE) and above</option>
<option value="256" <?php echo rollbar_get_error_level_match($current_val, 256); ?>>User-generated error messages (E_USER_ERROR) and above</option>
<option value="512" <?php echo rollbar_get_error_level_match($current_val, 512); ?>>User-generated warning messages (E_USER_WARNING) and above</option>
<option value="1024" <?php echo rollbar_get_error_level_match($current_val, 1024); ?>>User-generated notice messa
@joelataylor
joelataylor / get-videos.js
Created February 7, 2015 19:31
PhantomJS test
var page = new WebPage(),
testindex = 0,
loadInProgress = false,
fs = require('fs');
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.onLoadStarted = function() {