Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block dalethedeveloper

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dalethedeveloper / gist:1846552
Created Feb 16, 2012
Techniques for Anti-Aliasing @font-face on Windows
View gist:1846552

#Techniques for Anti-Aliasing @font-face on Windows

It all started with an email from a client: Do these fonts look funky to you? The title is prickly.

The font in question was Port Lligat Sans from Google Web Fonts.

The "prickly" is aliasing caused by lack of hinting

dalethedeveloper / gist:966848
Created May 11, 2011
Reorder a PHP array, moving items up or down
View gist:966848
A quick set of functions to move items in a non-associative array
up or down by one, shifting the items around it appropriately.
Original usage was to for a set of UP and DOWN buttons to
manipulate the order of an array of items stored in Wordpress option.
$a = array('a','b','c','d','e');
dalethedeveloper / gist:1503252
Created Dec 20, 2011
Mobile Device Detection via User Agent RegEx
View gist:1503252

#Mobile Device Detection via User Agent RegEx

Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.

I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.

The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".

Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(

dalethedeveloper / gist:1246351
Created Sep 27, 2011
Wordpress functions.php snippet to add Google Analytics tracking to wp_nav_menu with Yoast's plugin
View gist:1246351
For use in functions.php in combination with:
add_filter('wp_nav_menu', 'menu_ga_tracking', 99);
function menu_ga_tracking($menu) {
if( class_exists('GA_Filter') and yoast_ga_do_tracking() ) {
$menu = preg_replace_callback(
dalethedeveloper / gist:2294765
Created Apr 3, 2012
WordPress: Popup YouTube Videos in Thickbox (via shortcode)
View gist:2294765
* Add a custom shortcode to popup youtube videos in a thickbox overlay.
* Pastable to functions.php in a WordPress theme.
* Usage (in WP Editor):
* [ytp url=""]
* From:
dalethedeveloper / gist:3901835
Created Oct 16, 2012
WuFoo Form Javascript Embed Hack - Scroll to top on submit / error
View gist:3901835
This is the standard Javascript embed code for a WuFoo form with an
added var (iamnotscrolling) that delays a scroll to the top of the form
on submit or error.
We are hijacking the resizeDone function which fires after the form is
modified (this may have unintended consequences).
dalethedeveloper /
Created Dec 16, 2016
Extract a single WP Multisite Side DB Files
if [ $# -ne 1 ]
echo "Enter a WPMU ID for the Database"
DBS=$(mysql -u $WPUSER -p -ss $WPDBNAME -e "SHOW TABLES LIKE 'wp_$1_%'" | tr "\n" " ")
$(mysqldump -u $WPUSER -p $WPDBNAME $DBS > wp_$1_sql)
dalethedeveloper / gist:968926
Created May 12, 2011
Encrypt a WordPress Option using MySQL ENCRYPT()
View gist:968926
An example of using MySQL's ENCRYPT() and DECRYPT() functions to store
sensitive data in a Wordpress Option. In this case, a password.
This only provides a bare amount of security as your Key is likely stored somewhere
else in your code or database. Basically, its not plaintext.
dalethedeveloper /
Last active Feb 21, 2017
Transferring to/from Gmail accounts to a Google Apps account with imapsync. Also good for GApps to GApps transfers, archives, or migrations.
# Most of the tweaks here are wrapped up in gmailmig
# Props to brave folks who figured this out before me
dalethedeveloper / gist:1042934
Created Jun 23, 2011
Backup bash script for Webserver DB + Site Files
View gist:1042934
# Requires:
You can’t perform that action at this time.