Skip to content

Instantly share code, notes, and snippets.

View pwenzel's full-sized avatar

Paul Wenzel pwenzel

View GitHub Profile
@pwenzel
pwenzel / wordpress-cache-control.php
Created December 17, 2012 21:21
Make Cloudflare cache Wordpress pages for 5 minutes
<?php
if(!is_404()) {
// Set caching headers (cache for 5 minutes)
header('Cache-Control: max-age=300, must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s', strtotime('+5 minutes')).' GMT');
}
@pwenzel
pwenzel / ps1-color.bash
Created December 21, 2012 20:53
Set terminal colour based on local or remote session
# This sets the highlight colour based upon whether you're remote or local.
export PS1="\[${HC}\033]0;\u@\h: \w\[\007\]\[${cyan}\]\u\[${HC}\]@\h: \w \[${cyan}\]\$ \[${NC}\]"
@pwenzel
pwenzel / Makefile
Created March 2, 2013 19:48
Wordpress Project Makefile
.PHONY: install
install: clean wordpress
git submodule init;
@echo "\n\nNOTICE: You may need to configure a MySQL database for your Wordpress installation. Just run:"
@echo " mysql -u root -p;"
@echo " CREATE DATABASE example_site; \n"
wordpress: latest.tar.gz
tar -zxvf latest.tar.gz;
@pwenzel
pwenzel / README.md
Last active December 14, 2015 20:28
Set site/plugin options for all blogs in a network [WordPress Multisite] [WordPress]

Set options for all the blogs on a WordPress Multisite installation

@pwenzel
pwenzel / wpengine_cdn_url.php
Created March 27, 2013 16:36
Get WPEngine CDN URL for your blog.
<?php
if (class_exists('WpeCommon')){
$wpe_common = new WpeCommon();
$cdn_url = $wpe_common->get_cdn_domain($wpe_netdna_domains,get_bloginfo( 'url' ) );
}
@pwenzel
pwenzel / targeted-meta-tags.html
Last active December 18, 2015 05:09
Digital Underwriting META Tags
<meta name="mpr-site" content="news" />
<meta name="mpr-program" content="The Daily Circuit" />
<meta name="mpr-content-topic" content="issues" />
@pwenzel
pwenzel / Test page download with time and curl.sh
Last active December 24, 2015 07:59
Ways to check download times
time curl http://www.wikipedia.org > /dev/null
@pwenzel
pwenzel / meta.php
Created May 22, 2014 21:02
Wordpress meta tags without a plugin
<?php
/**
* @link Escape post content in META Attributes, http://codex.wordpress.org/Data_Validation
* @link Complete List of HTML Meta Tags, https://gist.github.com/kevinSuttle/1997924
* @example get_template_part('meta');
*/
?>
<meta name="twitter:card" content="summary">
<!--<meta name="twitter:site" content="@YOUR_TWITTER_HANDLE">-->
@pwenzel
pwenzel / 404-error-tracking.html
Created February 20, 2015 05:19
Track 404 errors as events with Google Universal Analytics, capturing the referrer as well.
<script type="text/javascript">
// Track 404 errors with Universal Analytics
if($('body').hasClass('error404')) {
ga('send', 'event', 'error', '404', 'page: ' + document.location.pathname + document.location.search + ' ref: ' + document.referrer, {'nonInteraction': 1});
}
</script>