Learning Node.js

I’m slowly attempting to learn Node.js. To do that I’m reading Getting MEAN with Mongo, Express, Angular, and Node, playing around with apps on Glitch, and creating a mini-app. I learn best by jumping in head first so I’m finding it helpful to write code for a real app even though I feel lost half the time. 

Node.js has a pretty steep learning curve, so I’m planning to document some of the challenges that I face along the way, even if it’s a simple bug that takes me a few minutes to figure out. The primary purpose of writing these posts is for my own future reference and to help me internalize the lessons I’m learning.

Reset Mac OS X Dictionary

I’m heavily reliant on the Mac OS X spell checker, but I sometimes click Add to Dictionary instead of the correct spelling. For obvious reasons, that isn’t good, so it’s helpful to know where those new words are stored. Here’s an example:

Screen Shot 2016-09-01 at 10.22.04 PM

You can view the custom dictionary by opening Finder and navigating to:

Users/USER_NAME/Library/Spelling/

In that directory, you’ll see an en file and a LocalDictionary file. You can open each of those files with the TextEdit.app and view the words that were added to the dictionary. Embarrassingly, my Local Dictionary file currently looks like this:

Screen Shot 2016-09-01 at 10.33.01 PM

Delete any unwanted words and save the file. The changes will take effect once you reboot.

Current as of Mac OS X 10.11.6 (El Capitan)

AppleScript – Executing JavaScript in Safari and Chrome

I haven’t used AppleScript much, but I was recently working on a script to automate a workflow and I was surprised to discover that each browser uses different commands to execute JavaScript.

Specifically, Safari uses do JavaScript "add code here" in document X and Chrome requires execute javascript "add code here"

Here’s an example of each:

Safari

tell application "Safari"
	open location "https://google.com"
	if (do JavaScript "document.readyState" in document 1) is "complete" then set pageLoaded to true
	display dialog pageLoaded as string
end tell

Google

tell application "Google Chrome"
     open location "https://google.com"
     if (execute javascript "document.readyState") is "complete" then set pageLoaded to true
     display dialog pageLoaded as string
end tell

A couple notes:

  1. AppleScript.app autocorrects the second example to a lowercase JavaScript, but either should work.
  2. Safari requires that a document is specified
  3. If you’re using Firefox, it’s currently not possible to execute JavaScript with AppleScript

Man-Made Wave

Man-made waves have existed for many years (as seen in the classic 80’s movie North Shore), but most of us doubted that we’d ever see anything that resembles a real wave.

Kelly Slater’s company has been working on creating a man-made wave for years and they recently released a video of a wave that shows a lot of promise.

Below is a video of Josh Kerr on one of his first waves in the new wave pool.

Rumor has it that the wave pool is in the Fresno area. That’s only a couple hours from where I live, so I hope the rumors are true.

They haven’t released any other other details, but it’ll be interesting to see how they structure the pricing and control the crowds once it opens to the public.

Only the Essential: Pacific Crest Trail Documentary

Yet another Pacific Crest Trail (PCT) documentary to add to your list: Only the Essential: Pacific Crest Trail Documentary

The film was created by Casey Gannon and Colin Arisman during their 2013 thru-hiked of the Pacific Crest Trail.  The film is short (less than 40 minutes) and does a great job of capturing the spirit of the trail.

The narrator’s voice was a bit monotonic and some of the stop motion videos were nauseating, but overall I enjoy it. They captured some amazing footage of desert and the mountains and it was refreshing to see their enthusiasm throughout the journey. Even though hikers are documenting their trips in increasing numbers, I still enjoy watching most of them and see new facets of the trail in each one.

It’s embedded below, but you can also check it out on the Wild Confluence Films site.