May 29th, 2018 #TIL, Data Structures & Algorithms Kerry 1 min read

AVL (2 scientist guys’ last names: Adelson-Velsky and Landis) Tree is a special BST (binary search tree). It solves the problem of a BST becoming unbalanced, which at its extreme, results in a linked list. It achieves this by recursively asking “Am I balanced?” after a new node is added. If the answer is “NO!” then single or double rotations need to occur depending on…

Array.find Returns undefined?

May 28th, 2018 Thoughts.Random() Kerry 1 min read

If Array.find doesn’t find the matching element, it returns undefined. The problem is when you try and pass the result of a find call into a function with a default parameter. If find results in undefined, the default value of the parameter will overwrite it. This isn’t the case if you pass in null. So then you have to end up doing a short-circuit ||,…

TIL Bloom Filter

May 20th, 2018 #TIL, Data Structures & Algorithms, JavaScript Kerry 1 min read

Refreshing some computer science concepts by taking Brian Holt’s course on FrontendMasters.com. The first part lesson was on Bloom Filter’s, which sounded complicated and scary. The concept ended up being easy to grasp and he presents a great example of a practical application. The devil is obviously in the details but knowing a tool exists and the reasons to use it is always a step…

TIL: Abstraction

Mar 25th, 2018 #TIL Kerry 1 min read

To quote Kyle Simpson, “Abstraction is about creating semantic boundaries between things.” This separation allows us to think about, reason about, and prove each individual piece. This is different than “hiding details” as that can better be described as encapsulation.  

TIL: == coerces operands to numbers

Mar 22nd, 2018 Thoughts.Random() Kerry 1 min read

Loose equality operator prefers to compare numbers so the following console.log is never executed:

bar is coerced to 99 and true to 1, and these are not equal.

TIL: -0

Mar 21st, 2018 #TIL, JavaScript Kerry 1 min read

Prior to ES6, the only way to check if a number is -0 is to divide any number by it and check if it equals -Infinity. With ES6, you can use Object.is(value, -0).  

TIL: NaN !== NaN

Mar 21st, 2018 #TIL, JavaScript Kerry 1 min read

NaN does not follow the identity property. NaN is the result of trying to convert a non-number to a number. NaN with any other operation is going to produce NaN. Number.isNaN does not convert prior to checking if a value is NaN. window/global.isNaN does. In ES6, you can check for NaN equality using Object.is().

Notes Part 2: “Functional Programming In Javascript” By Luis Atencio

Nov 4th, 2017 Thoughts.Random() Kerry 2 min read

Continued from Part 1. 3. Few data structures, many operations Control flow “On the other hand, declarative programs, specifically functional ones, raise the level of abstraction by using a minimally structured flow made up of independent black- box operations that connect in a simple topology.Method chaining” Separate control flow from computational logic, i.e. branches and iterations reduced or eliminated in favor of high-level abstractions Method…

Notes Part 1: “Functional Programming In Javascript” By Luis Atencio

Oct 26th, 2017 Thoughts.Random() Kerry 3 min read

I’ve started reading the book Functional Programming In Javascript by Luis Atencio and figured it’d be a good idea to take some notes. Might as well keep them here ^_^ 1.1 What is functional programming (FP)? “Abstract control flows and operations on data with functions to avoid side effects and reduce mutation of state” Fundamental concepts Declarative Easy to reason about Improves readability Pure functions Only…

TIL Relative Margin & Padding Are Calculated From the Parent’s Width!

Sep 6th, 2017 #TIL, CSS Kerry 1 min read

The learning is coming fast & furious these days. I’m only on my sixth TIL post though so Vin Diesel’s still got me by two movies and two billion dollars if I’m rounding up. This one’s a quickie! And totally makes sense but I never use CSS much these days and if I do it’s usually a CSS framework. Like the title says, Relative margin…