Open folder in Sublime on Mac

Here’s a short snippet for Sublime on Mac. Use this to open a folder in Sublime.

Via Finder
Open Automater and add a new shell script, here’s a screen

/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl -n $@

Via Terminal

ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime

jQuery anchor detection

Here’s a snippet to catch the anchor # in url’s with jQuery and do something with it. I needed this for ultra simple jQuery tabs.

$(document).ready(function() {
	// for page reload
	if(window.location.hash.length > 1) {
		// hash is found, similate click
		$('.tabs a[rel=' +window.location.hash.substring(1)+ ']').click();
	}
});
 
// dynamic change
$(window).bind('hashchange', function() {
	// hash is found, similate click
	$('.tabs a[rel=' +window.location.hash.substring(1)+ ']').click();
});