JS101: Linked Lists

My day to day responsibilities are somewhat far-removed from the concepts I learned in my Introductory Computer Science classes. I’m under the impression that engineers don’t need to know how to write their own BSTs, much less web developers. However, I firmly believe that the value in a college degree stems from learning how to think, not necessarily what you learn.

When I was interviewing for a technical role in the Bay Area, I picked up a book called Cracking the Coding Interview by Gayle Laakmann McDowell. After flipping through a few pages, I realized that it was unavoidable: I’d have to brush up on algorithms and data structures. In an attempt to explore the possibilities of object-oriented programming with JavaScript, I decided to see what it would look like to implement those academic topics in a new language. My first stop was the veritable linked list.

Source Code: https://github.com/tuanderful/js-101/tree/master/01_LinkedList

Continue reading

Defining Undefined

I came across a snippet of code that my colleague used to default configuration variables to true:

function someObj(config){
  someVar = config.someVar === undefined ? true : config.someVar;

I wanted to see how that pattern was used in other places, and if there was another way of setting the default of a configuration value to true. That search took me down a rabbit-hole of the undefined, and here is what I found…

Continue reading

Array: Slice vs. Splice

Although the two array methods slice and splice sound similar, they do different things, take different arguments, treat the original array differently, and return different objects. If that weren’t enough, slice also works on strings, but splice doesn’t! Here’s a quick comparison between the two.
Continue reading

I’m [in]

I thought I’d make a quick post to let everyone know two things, in no particular order:

  1. Any viewpoints and opinions expressed in this article are those of my own and do not, in any way, reflect those of my employer, my colleagues, or anyone else. I speak only for myself, not for them.
  2. I’m now a web dev at LinkedIn.

List and Delete Files with jQuery, JSON, PHP

I recently implemented functionality that would dynamically generate image files. As images are generated, they are cached on the server. As the cache grows, the user would have the option to view the files in the cache, and delete them all.

This tutorial will explain the interaction between the client and the server, how files within a directory can be read and deleted, and how to handle packaging and interpreting JSON responses with PHP and jQuery.

Continue reading