Skip to content

Instantly share code, notes, and snippets.

View pwenzel's full-sized avatar

Paul Wenzel pwenzel

View GitHub Profile
@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 / get_the_current_url.php
Last active June 30, 2018 06:26
Get Current URL with PHP. Inspired by CodeIgniter. Tested with Wordpress with and without fancy permalinks.
<?php
function get_the_current_url() {
$protocol = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$base_url = $protocol . "://" . $_SERVER['HTTP_HOST'];
$complete_url = $base_url . $_SERVER["REQUEST_URI"];
return $complete_url;
@pwenzel
pwenzel / google-maps-oembed-wordpress.php
Created February 1, 2013 22:45
Faux Google Maps oEmbed for Wordpress
<?php
/* Faux Google Maps oEmbed
* Embed google maps in a nicer iframe without using their provided embed code
* @usage Paste a Google Maps link in your post and it will be replaced with an iframe when published
* @link http://bigsaturday.net/oembed-google-maps-wordpress/
*/
wp_embed_register_handler( 'google_map', '#https://maps\.google\.com/maps(.*)#i', 'embed_google_map' );
function embed_google_map( $matches ) {
$query = parse_url($matches[0]);
@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 / Ancient OAS HEAD Snippet.html
Last active September 21, 2017 20:57
Ancient OAS Underwriting Snippets
<!-- OAS SETUP begin -->
<script language="javascript" type="text/javascript">
<!--//configuration
OAS_url = 'http://oascentral.publicradio.org/RealMedia/ads/';
OAS_sitepage = window.location.hostname + window.location.pathname;
OAS_listpos = 'TopRight,BottomRight,Right3';
OAS_query = '';
OAS_target = '_top';
//end of configuration
@pwenzel
pwenzel / google-tagmanager-datalayer-404.html
Created June 3, 2013 17:32
Google Tag Manager Snippets
<script>
dataLayer = [{
'Error': '404'
}];
</script>
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-XXXX..."></iframe></noscript>
<script>...</script>
<!-- End Google Tag Manager -->
@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 / ads.js
Created June 7, 2013 17:06
Digital Underwriting Javascript
/* Initialize Google Publisher Tags API - Docs: http://goo.gl/ZqOiy */
var gptadslots=[];
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function(){ var gads = document.createElement('script');
gads.async = true; gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);