Skip to content

Instantly share code, notes, and snippets.

// So what I'm doing here seems cool, but I'm not sure exactly what it's called.
// (also, I'm not doing anything smart here with execution context)
function partial( orig_func ) {
var ap = Array.prototype,
partial_args = ap.slice.call( arguments, 1 ),
invoked_args;
function fn() {
var result;
// 1: how could you rewrite the following to make it shorter?
// It can be done in one line, but it gets messy:
bar.[ foo? "doSomething" : "doSomethingElse" ]( el);
// 2: what is the faulty logic in the following code?
/*!
* m8 - JavaScript Math Library - v0.2
* by Kambfhase
* released under MIT License
*
* includes vice-versa by Andrea Giammarchi
*/
(function (Object, hasOwnProperty) {

This is a Walktrough of Evan Byrne's Class.js ( http://www.evanbyrne.com/article/class.js ). I comment the Code using //!. Please think of this walktrough as a help to avoid these mistakes in the future, not as an insult to the coder.

/*
* Class.js - Providing class structure for javascript
* Licensed under the General Public License (http://www.gnu.org/licenses/gpl.html)
* Copyright 2010 Evan Byrne (http://www.evanbyrne.com/article/class.js)
*/

Class.js, wow, that's creative. Ok, I admit my project names are shitty, too. :(

function Class(obj,args)