This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
WPUSER="username" | |
WPDBNAME="wp_db" | |
if [ $# -ne 1 ] | |
then | |
echo "Enter a WPMU ID for the Database" | |
exit | |
fi | |
DBS=$(mysql -u $WPUSER -p -ss $WPDBNAME -e "SHOW TABLES LIKE 'wp_$1_%'" | tr "\n" " ") | |
$(mysqldump -u $WPUSER -p $WPDBNAME $DBS > wp_$1_sql) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// I needed to trigger a non-interactive Google Analytics Event on external link click in | |
// Google Tag Manager v2. This is a hacky workaround for targeting external links on using | |
// a trigger like this: | |
// Event Type: Link Click [element: target] [starts with] ["_"] | |
// This is used as a HTML tag in Google Tag Manager v2 to normalize all external <A> links | |
// to have a "target" attribute. Priority 100, Triggered on All Pages and Event = gtm.dom | |
(function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assumes a tab delimited flat file and the first field being a numeric key | |
BEGIN { | |
FS = OFS = "\t"; | |
p = ""; | |
} | |
# Strategy is to readline, check for key in first field, store to print | |
# on next readline if the next record has a key in first field, otherwise | |
# append our fragmented line to the stored line | |
{ | |
sub(/\r/,""); # also scrub those pesky carriage returns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof (window.dataLayer) !== 'undefined' && window.dataLayer.length) { | |
for (var d = 0; d < window.dataLayer.length; d++) { | |
var obj = window.dataLayer[d], | |
keys = Object.keys(obj); | |
for (var k = 0; k < keys.length; k++) { | |
var key = keys[k], | |
val = obj[key]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script> | |
<script> | |
var rollem = function() { | |
var si = $('#slide ul.current'); | |
si.removeClass('current').fadeOut( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Drop at the end of your base .htaccess or virtualhost, hooray for negative lookaheads | |
RedirectMatch ^\/(?!wp\-admin)(.*)$ http://newdomain.com/$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function strip_img_hwattr($html) { | |
return preg_replace('/(width|height)=\"\d+\"\s/','',$html); | |
} | |
add_filter('post_thumbnail_html','strip_img_hwattr',100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# append to existing .htaccess | |
# PHP Settings http://www.rackspace.com/knowledge_center/product-faq/cloud-sites | |
php_value memory_limit 512M | |
php_value upload_max_filesize 32M | |
php_value post_max_size 32M | |
php_value max_execution_time 200 | |
php_value max_input_time 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Anywhere in the wp-config.php before the last include | |
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']); | |
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']); | |
define('DOMAIN_CURRENT_SITE', $_SERVER['HTTP_HOST']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get your credentials set in your environment before you run: | |
# export BB_USER="my_username" | |
# export BB_P="MySERCRETP4ss" | |
# export BB_OWNER="my_username_or_team" | |
for f in $(find -type d -path '.*git' |cut -d'.' -f2|sed 's:/::g'); do | |
g=$(curl -s -u $BB_USER:$BB_P "https://bitbucket.org/api/1.0/repositories/$BB_OWNER/$f") | |
rg=$(echo "$g" | grep -c error) |
NewerOlder