pwd with file name

I often am working with a file and need to copy it’s full absolute path. In the past, I always used pwd to grab the path, then typed a slash then ls’d the file name and copied that. I just stumbled across the realpath command which allows you to do this all in one step for quick copying/pasting of the absolute path.

readlink -f somefile.txt

which outputs:

/full/path/to/that/file/somefile.txt

It’s the little things!

What happened to the phpMyAdmin Process tab?

If you’re like me, you’ll note that the process tab from older versions of phpMyAdmin no longer exists on newer versions. I had resorted to viewing the process list in information_schema.PROCESSLIST and then grabbing the process ID and manually running a KILL on it.

Alas, the tool still exists – just look under the “Status” tab. Hooray!

How to check for all versions of IE (including IE 11)

Just found out this lovely tidbit today that IE 11 has decided to drop MSIE from its user-agent. That means that if you need to detect any version of IE, you’ll need to use a different regular expression.

This is what I came up with for my use case. The MSIE part captures <= 10 and the Trident part should capture 11+.

navigator.userAgent.match(/(MSIE|Trident\/.*rv:[0-9]*)/i)

How to extract domain from a URL in Excel

This is just a quick tip. Let’s say that you’ve got “http://www.google.com/search?q=1234″ in cell B1 in Excel, but you want to display “google.com”. You can use this formula:

=SUBSTITUTE(MID(B1, FIND(“//”, B1)+2, FIND(“/”, B1, FIND(“//”, B1)+2)-8), “www.”, “”)

This isn’t perfect as it assumes you always use “http://”, ┬ábut it works pretty well for a quick, easy fix.