This file contains hidden or 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($, w, d) { | |
function autoDetectGA() { | |
if (typeof _gaq !== 'undefined') { | |
return 'ga'; | |
} | |
if (typeof ga === 'function') { | |
return 'ua'; | |
} | |
if (typeof dataLayer !== 'undefined') { | |
return 'gtm'; |
This file contains hidden or 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($){ | |
$.expr[':'].outbound = function(elem, index, match){ | |
var att = 'nothing'; | |
if ($(elem).is('a') || $(elem).is('link')) { | |
att = 'href'; | |
} | |
if ($(elem).is('img') || $(elem).is('script')) { | |
att = 'src'; | |
} |
This file contains hidden or 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($){ | |
$.fn.appendAttr = function(attr, value, cat) { | |
var cat = cat || ","; | |
return $(this).each(function(){ | |
var a = $(this).attr(attr) || ""; | |
if (a) a = a + cat; | |
a = a + value; | |
$(this).attr(attr, a); | |
}); | |
} |
This file contains hidden or 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 () { | |
/** | |
* Track a virtual pageview | |
* @param url String the URL to send to GA. Developer will need to prefix as needed. /virtual/ for virtual pages, /download/ for downloads are a good startingpoint. | |
* @param title String (optional) Title to send with the page-hit. document.title will be used if omitted. | |
* @returns {Number} the result of the ga(), _gaq.push() or pageTracker._trackPageview call | |
*/ | |
window.gaPageview = function (url, title) { | |
title = title || false; | |
if (!title) { |
This file contains hidden or 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 short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// If you're not in IE (or IE version is less than 5) then: | |
// ie === undefined | |
// If you're in IE (>=5) then you can determine which version: | |
// ie === 7; // IE7 | |
// Thus, to detect IE: | |
// if (ie) {} |
This file contains hidden or 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($){ | |
$.fn.scrollIntoView = function(speed,callFunc) { | |
var that = this; | |
if ($(this).length > 0) { | |
setTimeout(function() { | |
var targetOffset = $(that).offset().top - 0.2 * $(window).innerHeight(); | |
$("html,body").animate({scrollTop: targetOffset}, speed || 500, callFunc); | |
},500); | |
} | |
return $(this); |
This file contains hidden or 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
UPDATE wp_posts SET post_title = CONVERT(CAST(CONVERT(post_title USING latin1) AS BINARY) USING utf8) |
This file contains hidden or 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
#!/usr/bin/env bash | |
if [ ! -f ~/.learnspamlock ]; then | |
touch ~/.learnspamlock | |
IFS=$'\n' | |
for i in ` find ./* | egrep "(Junk|spam)" | egrep "(cur|new)$" `; do | |
CNT=$(sa-learn --spam "$i" | egrep -o "from ([0-9]+)" | egrep -o "([0-9]+)" ) | |
if [ $CNT -gt 0 ]; then | |
echo $CNT spam messages trained in $i | |
else |
This file contains hidden or 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
update wp_posts set | |
post_content = replace(post_content, CONVERT(CAST(CONVERT('¡' USING utf8) AS BINARY) USING latin1), '¡'), | |
post_content = replace(post_content, CONVERT(CAST(CONVERT('¢' USING utf8) AS BINARY) USING latin1), '¢'), | |
post_content = replace(post_content, CONVERT(CAST(CONVERT('£' USING utf8) AS BINARY) USING latin1), '£'), | |
post_content = replace(post_content, CONVERT(CAST(CONVERT('¤' USING utf8) AS BINARY) USING latin1), '¤'), | |
post_content = replace(post_content, CONVERT(CAST(CONVERT('¥' USING utf8) AS BINARY) USING latin1), '¥'), | |
post_content = replace(post_content, CONVERT(CAST(CONVERT('¦' USING utf8) AS BINARY) USING latin1), '¦'), | |
post_content = replace(post_content, CONVERT(CAST(CONVERT('§' USING utf8) AS BINARY) USING latin1), '§'), | |
post_content = replace(post_content, CONVERT(CAST(CONVERT('¨' USING utf8) AS BINARY) USING latin1), '¨'), | |
post_content = replace(post_content, CONVERT(CAST(CONVERT('©' USING utf8) AS BINARY) USING latin1), '©'), |
This file contains hidden or 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
<?php | |
/*----------------------------------------- | |
REWRITE SEARCH URLS | |
-----------------------------------------*/ | |
// Redirect ?s=xxx to /search/xxx | |
function redirect_search_url() | |
{ | |
if (is_search() && !empty($_GET['s'])) { | |
wp_redirect(home_url('/' . _x('search' /* default search slug */, 'search url slug', THEME_TEXT_DOMAIN) . '/') . urlencode(get_query_var('s'))); |