Wishful Coding

Didn't you ever wish your
computer understood you?

Cross-domain caching

Looking at the list of HTTP headers at Wikipedia, you'll notice a few headers like If-Modified-Since, that serve to send content over only if it has changed since the last request. While working with JavaScrip frameworks like jQuery, the thought occurred to me, that maybe half of all the websites I open are using the exact same JS framework, isn't that a waste of bandwidth? The best real-life solution would be to get your JS from Google, so you at least share a cached version with others that do the same: http://code.google.com/apis/ajaxlibs/ My imaginary solution however, would allow the same file, served from different hosts to be cached only once. Look again at the list of headers... We're looking for something to identify files as equal... What about Content-MD5? It exists, right there! But as far as I can tell it's used for content-verification only. So I want to propose a new HTTP header: If-MD5-Differs What do you think about it? Cool? Useless? Security issues?

Automatically remove Trash from usb sticks

I think most Mac users have had this problem; You delete a bunch of files from your pen drive to make room for a large file, and it keeps complaining about lack of space. The problem is that when you remove files on Mac, they're just moved to a hidden folder named '.Trashes', so they are actually still there. A commonly suggested solution is to empty the Trash while the USB stick is plugged in, but this might be problematic in some cases where you want to keep your Trash, just in case...

Automatically remove Trash from usb sticks

My new solution is to set this little script as a folder action, it will remove the trash only from the USB stick as soon as you mount it(unmount proved problematic).
on adding folder items to this_folder after receiving these_items
    do shell script "rm -rf " & POSIX path of these_items & ".Trashes/"
end adding folder items to
Save this script to /Library/Scripts/Folder Action Scripts/ and now set it as the folder action for /Volumes. Automatically remove Trash from usb sticks You might need to show hidden files in Finder for /Volumes to be visible. To do this, follow this guide.

Write clean code!

Write clean code!