How to sort a list of locations by how close they are to you

One of the things that are most important to me for phase 1 of the state parks app is to have the list of parks be sorted by how far the user is from the park.  After all, Tower Hill State Park might be interesting but if you live 4 hours away, you aren’t likely …

Continue reading "How to sort a list of locations by how close they are to you"

What the heck is hoisting?

This is a topic that I have been avoiding (mainly because I don’t feel like I understand it enough).  I figure that we have to tackle the idea eventually, though.  Hoisting is a JavaScript mechanism where variable and function declarations are moved (or hoisted) to the top of the scope before the code is executed. …

Continue reading "What the heck is hoisting?"

Prototype.call() vs Prototype.apply()

This is going to be a relatively short post.  We have been doing a lot of [x] vs [y] vs [z] posts lately and this one is no different.  Today, I figured that we would look at Prototype.call() vs Prototype.apply().  Both apply() and call() are used to invoke functions.  The difference is that call uses …

Continue reading "Prototype.call() vs Prototype.apply()"

Playing with the OpenWeather API: The basics

Ever since Apple bought and shut down Dark Sky, I have been struggling to figure out what to replace it with.  I figured that this would be a good excuse to play with some weather APIs.  I have done this once before but that was with Rivets and YQL (neither of which I can necessarily …

Continue reading "Playing with the OpenWeather API: The basics"

Object.seal() vs Object.freeze()

So, you want to protect an object that you created in JavaScript?  With Object.seal() and Object.freeze(), you have two solid options that do slightly different things.  While Object.seal() prevents new properties from being added to the object and marks all existing properties as non-configurable, it still lets you change the values of properties.  Object.freeze() on …

Continue reading "Object.seal() vs Object.freeze()"