Category Archives: JavaScript

Getting Started with Ember.js: The Missing To-Dos Manual 2.0

Ember.js is a lightweight JavaScript framework that packs a heavy punch when it comes to binding data between objects and making the appropriate updates to the view template. As websites continue to trend towards using CSS and JavaScript to create rich interactions (sans Flash) and more of the business logic shifts to the client side, this framework helps alleviate a lot of the tedious scripting.

I first heard of Ember.js when I was exploring SproutCore, which was on version 1.6 (released in June 2011). SproutCore 2.0 was announced in May 2011, but was later renamed Ember.js (which is currently on version 0.9.7.1), while SproutCore recently came out with version 1.8 in March 2012.

SproutCore 1.6 featured excellent documentation that showed how to create a To-Do list quickly. I couldn’t find a comparable tutorial for Ember.js, so I figured I’d write my own.

Continue reading

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

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

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