JavaScript

Angular JS Doesn't Suck

So I read this somewhat legendary rant about how JQuery is better than AngularJS, and AngularJS will fail. It's not going to fail.

It's just hard to learn. It's also verbose. You could say the same about any of the OO descendents of C. The difficulty generally comes from learning where your code should reside in the framework. Verbosity is just part of writing larger programs, and Angular is about writing larger programs. Maybe not large programs, but larger than a thousand lines.

My Second Angular Directive - Menus

This was downright difficult. The good news is that the code got a little shorter, the HTML is a LOT shorter, the menu settings are in a shorter config file, and the direct manipulation of the DOM has reduced significantly.

When the user clicks on a menu item, here's what happened:

The original scanned the DOM to toggle off the current item. Then toggled the new item.

Now, the new version maintains a copy of the menu configuration, and alters this model. A loop scans the model and sets a "selected" bit, then triggers the animations.

My First AngularJS Directive: Stretchdown - stretches an element to the bottom of the window.

I've made may first directive! OK, not that special, but to me it is. This is one of the more difficult features I've come across in Angular, and I still don't really "get it".

I'm not even going to do a code walkthrough, because I can't really explain it well. The easy part is calculating the height the element should be. The tricky part is implementation.

Tiny Javascript Cookie Library

This is one of those "why bother with an external library" moments. Mostly copied from MDN.

Button to Scroll to Top of the Page

Mobile websites all seem to have this button, which appears when you've scrolled down a bit. The button scrolls you back to the top of the page, where most of the menus reside.

Using strings to create functions

One of the less-used features is the Function() object, which can turn a string of Javascript code into a function. This is an example of how it can be useful.

Bookmarklet to Mass-Unfollow Twitter Users

I almost wrote a page for this, but it turns out a bookmarklet is good enough:

javascript:$('.js-follow-btn').click();undefined;

Learning Javascript via the Read Eval Print Loop (REPL)

All the tutorials out there teach JS by having the user write a file, and load it into the browser.

Javascript APIs and Libraries Change the Game

I was thinking a bit about the JS co-learning thing, and discovered that services, APIs and libraries really change the game, or have changed the game.

Horizontal Javascript Class

Sketching out a possible class for learning Javascript / learning to learn Javascript / learning to teach Javascript.

Prelims:
HTML and DOM
CSS and DOM

JS localStorage Demo

The attached file is a rudimentary demonstration of persistent local storage in the browser. You can click on it to see the page in action, and do a view source on that page.

Photo Wall that Scrolls Forever Loading New Photos at Bottom

I was reading the code at iworkfortheinternet.org and learned how to do this "scrolling forever wall" effect. It's clever.

What is HTML 5?

HTML 5 is a marketing term (kind of like "cloud computing") that has a somewhat imprecise technical meaning, but was created so that products and people could easily sum up their compatibility or know

Hashcash Anti-Spam

A ten second calculation to deter comment spam. It's an old technique called "hash cash" and has nothing to do with drugs.

Comparison Shopping for Toilet Paper, in multiple computer languages.

It's hard to concentrate when you're tired and cranky, so I wasted some time writing a simple calculator in several different languages.

Syndicate content