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
<!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
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
# 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
<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
/** | |
* Works in Chrome, Firefox, MSIE, Opera and Safari. | |
*/ | |
function onDOMContentLoaded( event ) { | |
if( event ) { | |
document.removeEventListener( event.type, onDOMContentLoaded, false ); | |
} | |
document.onreadystatechange = null; | |
// For testing purposes. | |
alert( "DOM Content Loaded" ); |
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
/** | |
* A class-based approach to bring in Facbook Connect asynchronously on every | |
* frontend page load. Also handles side-loading channelURL when using | |
* Facebook's FB.init() method. | |
* | |
* This fits nicely in any functions.php, or can be dropped in to a standalone | |
* php file to use as a plugin. | |
* | |
* @link http://developers.facebook.com/docs/reference/javascript/FB.init/ | |
*/ |
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
/* When an html page like URL is accessed, return some static content, | |
In this case, a verification page for Google Apps | |
In the current theme functions.php: | |
*/ | |
if( !class_exists('google_verify') ) { | |
class google_verify { | |
public function __construct() { | |
add_filter('rewrite_rules_array', array($this,'gv_rewrite') ); | |
if( !is_admin() ) { |
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
// Adapted from jQuery TimeAgo plugin: | |
// https://github.com/rmm5t/jquery-timeago/blob/master/jquery.timeago.js | |
// Update, check out performance: http://jsperf.com/twitter-relative-time-parsing | |
function timetowords(timestamp) { | |
var words = { | |
"seconds": "less than a minute", | |
"minute": "about a minute", | |
"minutes": "%d minutes", |
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
jQuery(document).ready(function($) { | |
$.getJSON('http://twitter.com/statuses/user_timeline/Shitmydadsays.json?count=4&callback=?', function(data){ | |
var relative_time = function(datetime) { | |
var delta = parseInt((Date.now() - Date.parse(datetime)) / 1000, 10); | |
var r = ''; | |
if (delta < 60) { | |
r = delta + ' seconds ago'; | |
} else if (delta < 120) { | |
r = 'A minute ago'; | |
} else if (delta < (45 * 60)) { |
OlderNewer