LocalStorage gotchas in Internet Explorer and Safari

localStorage.setItem will throw an “Access denied” error in Internet Explorer InPrivate Browsing mode. Likewise, Safari will give you QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota. To avoid those errors, you will need to wrap your localStorage access in a try/catch block.

Deleting directories while preserving symlinks

At work, we needed to replace a pre-existing folder with a symlink. We wanted to symlink the user’s .git/hooks folder to ../build/git-hooks every time the script was run. We wanted to delete .git/hooks if it existed and replace it with a symlink, but we also wanted to avoid deleting ../build/git-hooks‘s contents by accident if the […]

Fixing Tunnelblick disconnecting in OS X 10.10 Yosemite

If you have just upgraded to Yosemite, you might have run into issues with Tunnelblick. First, it will connect properly, then disconnect immediately after. To fix this, open the Tunnelblick connection settings, click “Advanced settings” and uncheck “Flush DNS cache after connecting or disconnecting”.

Knowing the difference between mtime, ctime and atime

If you are dealing with files, you might wonder what the difference is between mtime, ctime and atime. mtime, or modification time, is when the file was last modified. When you change the contents of a file, its mtime changes. ctime, or change time, is when the file’s property changes. It will always be changed […]

Solving AirPort Extreme FTP issues

Recently, I’ve been having tons of problems when using FTP at home. I have a Macbook Pro, an Airport Extreme and use Cyberduck to access my remote FTP servers. It appears that the latest firmware (7.6.x) for the Airport Extreme has issues with FTP connections. In my case, the router would randomly crash while using […]

How to create big test files in OS X and Linux

If you need to have large files to test your application, there is a command in OS X and Linux that allows you to create a file of an arbitrary size. We already know that you can create an empty file by using touch: touch myfile.ext You can also create files with a preset size […]

Can’t output OS X audio to AirPlay? Here’s the fix.

Once in a while, I won’t be able to output my Macbook’s audio to my Apple TV. The solution is rather simple: you need to kill coreaudiod. You can achieve this from Activity Monitor or enter the following command in Terminal: sudo kill `ps -ax | grep ‘coreaudiod’ | grep ‘sbin’ |awk ‘{print $1}’`

Add some color to the OSX Terminal

If you find the OS X Terminal’s lack of color hard on the eyes, here’s how to set the colors. To get this color scheme, open ~/.bash_profile and add this: export CLICOLOR=1 export LSCOLORS=GxFxCxDxBxegedabagaced export PS1=”\[\033[36m\]\u\[\033[m\]\[\033[32m\]:\[\033[33;1m\]\W\[\033[m\]\$ ” alias ls=’ls -GFh’ The first line enables colors, the second sets the colors for ls and the last […]

How to disable the Chrome notification icon in OS X

In a recent Chrome update, a new bell icon popped up in the OS X notification bar. You can disable this icon in 3 easy steps: Open chrome://flags Disable “Enable Rich Notifications” Restart Chrome It’s gone! May 2014 update: It’s now called “Notification Center behavior”, and you must set it to “Never show” There is […]