Skip to content

Instantly share code, notes, and snippets.

@geoffyuen
geoffyuen / nav highlighter
Created January 29, 2014 21:15
Adds .active class to an <a> if the url (page and extension only) == the a.href inside .site-menu class
$('.active').removeClass('active');
$('.site-menu a[href$="' + location.pathname.substring().split("/").pop() + '"]').addClass('active');
@geoffyuen
geoffyuen / boilerplate-additions
Last active August 29, 2015 14:02
Things to plugin into boilerplate
Put this before doctype for force IE to remove compatibility button (in addition to <meta http-equiv="X-UA-Compatible" content="IE=edge">):
<!--[if IE]><![endif]-->
Live reload script for localhost (handy when using iframes):
<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>
@geoffyuen
geoffyuen / getip.command
Created July 9, 2014 15:54
osx, get ip from terminal
ipconfig getifaddr en0
OUTPUT=$(ipconfig getifaddr en0); echo ${OUTPUT}
@geoffyuen
geoffyuen / wp-content
Created July 10, 2014 03:02
download the wp-content folder via ftp. (this will create the wp-folder in the current directory)
wget -m -nH ftp://user:pass@serverurl//wp-content
@geoffyuen
geoffyuen / nongreedy.txt
Created August 6, 2014 18:36
Regex Reminder: not so greedy selector
Instead of using .*
try .+?
@geoffyuen
geoffyuen / functions.php
Created August 17, 2014 22:21
Livereload when you save a post or page in Wordpress (with Grunt watching php for changes)
// add to your functions.php
// for development only
function livereload() {
touch( get_template_directory() . '/livereload.php');
}
add_action( 'save_post', 'livereload' );
@geoffyuen
geoffyuen / inc-events-cal.php
Created August 22, 2014 02:47
Show The Events Calendar when using Timber WP
// capture tribe_show_month() from The Events Calendar Plugin
ob_start();
query_posts('post_type=tribe_events');
tribe_show_month();
$context['tribe_dump'] = ob_get_contents();
ob_end_clean();
@geoffyuen
geoffyuen / youtube.html
Created September 2, 2014 15:13
youtube minimal chrome
http://www.youtube.com/embed/<?=$row[0]?>?rel=0&autohide=1&showinfo=0
@geoffyuen
geoffyuen / gist:47a8964536655fe76785
Created September 22, 2014 17:20
get around git:// blocked by firewall
git config --global url."https://".insteadOf git://
# http://stackoverflow.com/questions/16298986/unable-to-connect-to-github-com-for-cloning
@geoffyuen
geoffyuen / vagrantie
Created October 22, 2014 18:23
Modern.ie Vagrant Boxes
XP with IE6: http://aka.ms/vagrant-xp-ie6
XP with IE8: http://aka.ms/vagrant-xp-ie8
Vista with IE7: http://aka.ms/vagrant-vista-ie7
Windows 7 with IE8: http://aka.ms/vagrant-win7-ie8
Windows 7 with IE9: http://aka.ms/vagrant-win7-ie9
Windows 7 with IE10: http://aka.ms/vagrant-win7-ie10
Windows 7 with IE11: http://aka.ms/vagrant-win7-ie11
Windows 8 with IE10: http://aka.ms/vagrant-win8-ie10
Windows 8.1 with IE11: http://aka.ms/vagrant-win81-ie11