Categories
Mac

Run Hazel rule based on the day of the week

Hazel-for-Mac-iconI LOVE HAZEL.

Now that I made that clear, let’s get into the actual stuff.

As many of you will know, Hazel is a great Mac utility that lets you automatically do stuff to files. You can move files based on their name/size/extension/you name it, and do a bunch of cool stuff with them, without ever having to write a single line of code.

Today I needed to write a rule that would act based on the day of the week a file was created1.

Turns out, Hazel can do that (not much of a surprise, huh?), but this time I didn’t find it particularly intuitive how to do it. You have to use the “Occurs after” function on the “Created date” (or any date, actually). In this example, this rules will only run on files that have been created after 00.00 on Mondays only, i.e. any file created on Mondays.

Hazel rule day of week(Don’t be confused by the weird names on the “day of week” submenu, they’re just the Italian names for the days of the week.)

The cool thing is that you can select more than one day, so as always Hazel is very flexible.

  1. I use a Sony ICD PX333 Voice Recorder to record classes, and I want to rename them based on the day of the week, since what we do depends on the day of the week
Categories
Miscellanea

Get pretty date differences in PHP

Today I needed a quick way to get the time difference from an UNIX timestamp to the current date. To get an idea, it’s like the little date you see on Twitter.com, for example “5m” if the tweet was posted 5 minutes ago.

Here’s my quick-and-dirty PHP code, it just takes the timestamp as an input and returns the formatted output. Feel free to fork it and improve it!