Goin' Full Require: Moving To AMD

2012 Nov02
A

MD ( [Asyncronous Module Definition](http://wiki.commonjs.org/wiki/CommonJS) ) is a apart of the [CommonJS](http://www.commonjs.org/) movement. It aims to bring something to javasscript is very much needed in todays world of browser based applications. And that is the idea of modules. A logical way of breaking your apps into smaller, more logical peices and import dependencies only in the situations that you actually need them. [RequireJS](http://www.requirejs.org) is at the fore front of JavaScript Module loaders, and for good reason. When you start to dig into RequireJS, you'll find that it isn't just a fancy script loader, but more of a micro-framework for managing large JavaSscript Apps.

Make The Move

Its

Read More
filed under:  javascript amd requirejs modules

Fun With Mootools Part 2: Protected Methods

2012 Jul17
P

rivate and protected class methods can come in handy when creating complex applications. While JavaScript doesn't provide these features natively, [Mootools](http://mootools.net) provides a mechanism to define protected methods on a class. Protected means that the function can only be called by the originating class or a sub-class of the originating class. An attempt to call a protected function by a different class or from an instance of the class would result in error. Here is how you do that with a mootools classs:

var SecretClass = new Class({
	Implements:[Options]
	, initialize: function( options ){
		this.setOptions( options );
		var s = this.protectedMethod();
	}

	/**
	 * A regular class method 
	 */
	,publicMethod: function( name ){
		alert("Hello" + ( name || "world") + "!"
Read More
filed under:  mootools class javascript oop

Pythonic Iterators With Mootools

2012 Jun12
P

ython comes standard with an interesting module called, itertools, which provides a set of functions that make performing complex computations that revolve around iteration much easier. It is actually a invaluable set of tools to have at your disposal when you get comfortable with them. The module itself can work with anything that implements the iterator interface. An iterator is an object wrapper around some sequence that exposes a method called next. When the next method is called, the iterator should return the next item in the sequence and throws a StopIteration exception when there is nothing left in the sequence. While JavaScript doesn't offer anything that would resemble an iterator, that are actually very simple to implement when

Read More

Create A File Watcher With NodeJS and Child Process

2012 Apr15
I

t is not uncommon in the life of a software developer to want to execute a series of tasks every time a file changes. It tends to come up more frequently in development, for example, you might want to concatenate a series of files, or send and email to an administrator, etc. It becomes even more beneficial to be able to watch all of the files in a given directory. Surprisingly, for as much as it seems to creep up, it tends not to be standard machinery it a large number of programming languages and their standard libraries. Luckily, [Node.js](http://www.nodejs.org) gives you all of the [tools](http://http://nodejs.org/api/fs.html#fs_

Read More

Fun With Mootools Part 1: The Class toElement method

2012 Apr14
T

he [MooTools](http://www.mootools.net) ( My Object Orientated Tools ) JavaScript framework is a pretty sweet piece of software. It's goal is to make developing with JavaScript easier. It provides large set of tools for building complex JavaScript applications. There are a lot of hidden [goodies](http://www.youtube.com/watch?v=6nOVQDMOvvE) tucked away in the framework that kick off one of those ["AHa!" moments](http://en.wikipedia.org/wiki/Eureka_effect). One of those goodies is the toElement method on classes. One of those goodies is the **toElement** method on classes.

The Class' method, toElement, works in tandem with the MooTools document.id ( $ ) method. In most cases, Classes center around a DOM element for some reason

Read More
filed under:  dom mootools class javascript oop