Quantcast
Channel: There's a Pattern for That » JavaScript
Browsing all 17 articles
Browse latest View live

string.Format() in JavaScript

I love the string.format pattern in .net. It can clean up strings in your code that would otherwise be horrible to maintain. When programming in JavaScript I have often wished for the same function....

View Article



Looking at JavaScript Hash as a Case Alternitive

I had to do a mapping today and used the hash properties of objects in JavaScript to take care of it. function a(key) { var myHash = { 'valueOne':'mapedToA', 'valueTwo':'mapedToB',...

View Article

Using jQuery to Select the Last Node in a Tree

I worked on some code to show the classes that were being used on some div’s for a presentation. I wanted to be able to have the text of the class attribute show in the final container to give an idea...

View Article

Image may be NSFW.
Clik here to view.

Grouping Items in a List Using Underscore and Reduce

List comprehension functions make solving problems with groups or lists much easier. The two most basic of the functions are Map and Reduce. From these two you can build any other operation you want....

View Article

The Ternary Operator as If / Else Shorthand

In my last post i created the following piece of code to group names from a list into a hash by their first letter. Looking at I though about how it could be reduced to something simpler with the...

View Article


Intro to Backbone Routing

Routing is a method of triggering state. In your site you have paths that bring a user to different pages that provide specific content. Routes are just like that but for a single page. They provide a...

View Article

Clean JavaScript consol.log() Shortcut

A while ago I posted a article about how to do something like string.Format() in C# .net. Recently I started using it more frequently for logging and had the idea to extend string again to save time...

View Article

Build a Better Bar Chart Using SVG and HTML

How to Build a Better Bar Chart NOTICE: Your browser must be able to render SVG for you to see the examples on this page. Most people looking at SVG are trying to do some sort of charting. Starting off...

View Article


Communeicator.com – The Free, Private, Secret Message Encoder.

How it came to be I started a side project to use some of the libraries I’ve been getting more experience with. I came up with the idea of a site that could encode messages and then decode them all in...

View Article


Angualr.js $apply, $digest, Thread Blocking and Preemption

It’s been a week since I gave a talk about Angular.js and someone mentioned the importance of not calling $apply during a $digest cycle. I have read this too, but it struck me at the time that this...

View Article

Getting the path of a script file during execution

Recently I was looking at a script in an Angular.js controller that used a template. An absolute path was being used to reference the template from the controller in each as this was the way the...

View Article

Rethinking Single Loop Optimization to Enable Modular Design

It’s not uncommon to hear that you can make a program more efficient by combining loops. The idea is “why loop over something three times when you can loop over it once?”. However there is danger in...

View Article

Simple Express.js. Setup, Plus Routes.

I’ve dabbled in Node.js here and there but recently I dove head in head first to work on a personal project. When getting started with Express it was easy to find examples that had much more than what...

View Article


Top Down Angular.js

This last weekend I presented at Self.Conference in Detroit, MI what is the last version of my Angular.js talk. The talk has evolved along the lines of what I see as the most powerful and accessible...

View Article

Learning Angular.js

Angular.js is a powerful library that once you understand it, can be incredibly easy to work with. That is, once you know how to use it. However I believe that most of the struggle in learning Angular...

View Article


The Most Basic Angular App

Getting an App running with Angular is fairly simple. Like all JavaScript libraries you will need to link to it with a script tag. After that add “ng-app” as an attribute to any tag besides head....

View Article

Directives, Scope, and Expressions

So in the previous post ng-app was used to mark tag where Angular would be rooted. In that tag we used an expression and could see that a value was being updated by seeing the correct output on the...

View Article

Browsing all 17 articles
Browse latest View live




Latest Images