Find your jQuery version

Sometimes the version number of a referenced jQuery library isn’t readily available in the script src or minified code comments. Here are a few statements to plug in to your browser’s developer console…

>
//recommended
jQuery.prototype.jquery
//or use
jQuery.fn.jquery
//assumes no dollar sign conflict
$.fn.jquery

15. March 2012 by erikhaddad
Categories: Tips and Tricks | Tags: | Leave a comment

Convert Case of Files and Folders

I’m working with a large data set with uppercase and lowercase filenames and folders. I needed a quick way to execute a recursive rename and here’s the shell scripting I used:

Create the following two files in /usr/local/bin

“lcase”

$ for i in `find * -depth`; do (mv $i `echo $i|tr [:upper:] [:lower:]`); done

“ucase”

$ for i in `find * -depth`; do (mv $i `echo $i|tr [:lower:] [:upper:]`); done

Still in /usr/local/bin, now add execute permissions for all.

$ sudo chmod a+x lcase
$ sudo chmod a+x ucase

Now navigate to your parent directory that contains all your files and folders.

Execute this command for converting all files and folders to lowercase:

$ lcase

Execute this command for converting all files and folders to uppercase:

$ ucase

Success! Your files and folders have been renamed.

04. March 2012 by erikhaddad
Categories: Tips and Tricks | Tags: , , , , | Leave a comment

Remove OS X Software Update CatalogURL

Mountain LionI use a MacBook Pro provided by my employer and they redirect update requests to their own Software Update Server by default.

To get around this, I execute the following line in Terminal:

$ defaults delete /Library/Preferences/com.apple.SoftwareUpdate CatalogURL

04. March 2012 by erikhaddad
Categories: Tips and Tricks | Tags: , | Leave a comment