I’ve gotten skilled at shell scripting over the years. I love a good GUI but knowing how to automate makes you a much more powerful engineer. Much of my scripting requires recursing over directories and processing a file if it meets a given criteria, which is often file extension or MIME type.
You can use the following shell command to get a file’s MIME type:
file --mime-type -b Downloads/main.js # text/plain file --mime-type -b Downloads/logo.jpg # image/jpeg
It’s important to use the brief (
-b) option in the command or you may receive an error message.
MIME type is used for validation and any number of other informational use cases. Luckily the
file command and and a flag is all you need!
Facebook Open Graph META Tags
It’s no secret that Facebook has become a major traffic driver for all types of websites. Nowadays even large corporations steer consumers toward their Facebook pages instead of the corporate websites directly. And of course there are Facebook “Like” and “Recommend” widgets on every website. One…
CSS vs. JS Animation: Which is Faster?
MooTools onLoad SmoothScrolling
SmoothScroll is a fantastic MooTools plugin but smooth scrolling only occurs when the anchor is on the same page. Making SmoothScroll work across pages is as easy as a few extra line of MooTools and a querystring variable. The MooTools / PHP Of course, this is a…