Skip to content

Instantly share code, notes, and snippets.

View navitronic's full-sized avatar
👋

Adrian Palmer navitronic

👋
View GitHub Profile
@navitronic
navitronic / gist:758177
Created December 29, 2010 04:35
PHP Code to remove Google Analytics cruft from urls
<?php
preg_replace('/(\?|\&)?utm_[a-z]+=[^\&]+/', '', 'http://mashable.com/2010/12/14/android-quick-start-guide/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29');
// Returns http://mashable.com/2010/12/14/android-quick-start-guide/
# 100 urls to test against
# ========================
#
# http://activeinboxhq.com/?utm_medium=Argyle+Social&utm_source=TweetDeck&utm_content=http=//activeinboxhq.com/
$(document).ready(function(){
// Local Scroll
function filterPath(string) {
return string.replace(/^\//,'').replace(/(index|default).[a-zA-Z]{3,4}$/,'').replace(/\/$/,'');
}
$('a[href*=#]').each(function() {
if (
filterPath(location.pathname) == filterPath(this.pathname)
&& location.hostname == this.hostname
&& this.hash.replace(/#/,'')
// Extend jQuery to add a function for implementing "Nice Inputs"
jQuery.fn.makeNiceInput = function(){
// Setup the selected elements as nice inputs.
jQuery(this).each(function(){
if(jQuery('label[for='+jQuery(this).attr('id')+']').length > 0){
var MNval = jQuery('label[for='+jQuery(this).attr('id')+']').hide().text();