November 25th, 2017
The following code uses generators to create a fibonacci sequence.
November 21st, 2017
XMLHttpRequest object (which is as poorly named as AJAX - it can be used for much more than XML!)1.
I made a custom google search API which was really easy and fun to create2! It searches certain websites for cat related posts (and is appropriately called meowmeow)! Who wouldn't love that? In my code I retrieve the article names from the top 10 searches in my custom meow search. The code uses the
XMLHttpRequest object and a callback function:
November 20th, 2017
this works. Arrow functions look to 'fix' these confusions by implementing a lexical
this. Now the value of
this in an arrow function depends on what
this was equal to when arrow function was written (instead of when its called). This leads to confusing behavior if you are expecting arrow functions to act like normal function definitions. Let's look at an example.
November 15th, 2017
this from containing the global scope variable. What else does strict mode have to offer?
November 14th, 2017
Sorting Lists with Comparison Functions
November 13th, 2017
window, which represents the browser window. Window exposes an API for interaction with the Document Object Model (DOM), click listeners, and other information about the browser window1.
In the past I have used the
window object to check the current URL and previous page visited by the user (to create a 'back' button). However, the most common use of
window is to manipulate the DOM and set click listeners (I used frameworks such as JQuery to perform these tasks in the past).
November 12th, 2017
Challenges with Neo4j Graph Creation
In my last discovery post on graph databases and Neo4j, I created a graph representing a map of Fairfield County, Connecticut. I created nodes for all the towns/cities and edges between the settlements that shared borders. This discovery adds to the graph and shows some of the challenges I faced along the way. Let's dive in!
First I populated the graph with some people (after all, a settlement needs citizens!).
November 11th, 2017
this I took shortcuts such as the popular
var self = this statement so I wouldn't worry about the value of
this in nested functions.
this so confusing is that it's set at runtime instead of author time (compile time)1. In other words it doesn't follow the rules of lexical scope that I am comfortable with.
this is incredibly daunting for new programmers since its value can be different when calling the same function on separate occasions.
November 10th, 2017
ES6 Modules Run with Babel
The only change to the API is the
export is a new keyword in ES6 that reveals the function
November 9th, 2017
This module provides lyrics for Taylor Swift songs (because who doesn't enjoy some T-Swift!) The
return statement is the public API for the module. All interior details, such as the
November 8th, 2017
November 6th, 2017
Creating a Simple Geographical Map with Neo4j and Cypher
Lately I've read about graph databases and their place in the NoSQL data storage universe. The graph database I've worked with is Neo4j, which is fun and easy to get started with. I found the user interface very enjoyable for viewing graphs and executing queries. I highly recommend it if you need a graph database solution.
Graph databases largest draw is related data storage and the speed at which you can query related data points (or in graph terms, nodes/vertices). Relationships are first class citizens, which allows related data queries to be executed by traversing relationships themselves. This is contrasted with a typical relational database where you have to find relationships through foreign keys or combine two tables with a very slow SQL
JOIN operation1. The same slow query in a RDBMS (Relational DataBase Management System) is extremely quick in a graph database.