Update: @twitinsin points out that it’s still useful in the console for quickly declaring multiple variables.

I developed the habit of always using var when I write JavaScript long ago. At some point I got in the habit of typing var even when I’m using a JavaScript console in node or in a browser. After examining the issues I’ve decided to break that habit.

I think I got in the habit of this because I came to appreciate explicit variable declaration, and decided to gladly pay the tax. The four extra characters, including the space, isn’t bad. But it doesn’t serve a useful purpose in short console sessions. Without var, it’s still valid JavaScript, that will run in node.js and in any browser. It won’t pass JSHint and JSLint, which is why it should always be added before delivering code.

If this gets me to be just a little quicker to fire up a REPL (a more generic term which includes the JavaScript console), it will be an improvement.

I have an Apple Bluetooth keyboard and touchpad for my MacBook Pro that I keep in my upstairs bedroom at home. I leave it on all the time. When I’m at home, my MBP automatically connects to it, and disables the touchpad on my MBP. This would be useful if I was only using a bluetooth TouchPad and was using the MBP keyboard, as I could use the MBP keyboard without worrying about accidentally touching the TouchPad on the wrist rest on my MBP. With my external keyboard the disabling of the MBP TouchPad isn’t all that useful, but I still like it, except for one minor issue.

The issue is when I come home and decide to use my MBP on the dining room table, or the couch downstairs. Bluetooth works across that distance. When I did this I had to go upstairs and either grab my bluetooth keyboard and touchpad or turn them off. I wasn’t able to turn off bluetooth on my computer because I can’t use my MBP’s TouchPad to click the Bluetooth icon in the OS X Menu Bar, when the bluetooth TouchPad is enabled and the MBP’s TouchPad is disabled.

I no longer have this problem, since I found a way I can disable the bluetooth with my keyboard. All I have to do is install blueutil, which I can do with homebrew.

brew install blueutil   # install it
blueutil power 0        # turn bluetooth off

Once I turn bluetooth off, my MBP’s TouchPad becomes enabled, and I can start using it!

Repositoryblueutil
Ownertoy