Skip to content

Instantly share code, notes, and snippets.

@haileys
Created October 15, 2011 12:36
Show Gist options
  • Save haileys/1289499 to your computer and use it in GitHub Desktop.
Save haileys/1289499 to your computer and use it in GitHub Desktop.
var Animal, Horse, Snake, sam, tom;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
Animal = (function() {
function Animal(name) {
this.name = name;
}
Animal.prototype.move = function(meters) {
return alert(this.name + (" moved " + meters + "m."));
};
return Animal;
})();
Snake = (function() {
__extends(Snake, Animal);
function Snake() {
Snake.__super__.constructor.apply(this, arguments);
}
Snake.prototype.move = function() {
alert("Slithering...");
return Snake.__super__.move.call(this, 5);
};
return Snake;
})();
Horse = (function() {
__extends(Horse, Animal);
function Horse() {
Horse.__super__.constructor.apply(this, arguments);
}
Horse.prototype.move = function() {
alert("Galloping...");
return Horse.__super__.move.call(this, 45);
};
return Horse;
})();
sam = new Snake("Sammy the Python");
tom = new Horse("Tommy the Palomino");
sam.move();
tom.move();
var __stack = [], __stack_sizes = [], __tmp;
__stack_sizes.push(__stack.length);
var Animal;
__stack.length = __stack_sizes.pop();
__stack_sizes.push(__stack.length);
var Horse;
__stack.length = __stack_sizes.pop();
__stack_sizes.push(__stack.length);
var Snake;
__stack.length = __stack_sizes.pop();
__stack_sizes.push(__stack.length);
var sam;
__stack.length = __stack_sizes.pop();
var tom;
__stack_sizes.push(__stack.length);
__stack.push(Object);
__stack.push(__stack.pop().prototype);
__stack.push(__stack.pop().hasOwnProperty);
var __hasProp;
__stack.push(__hasProp = __stack.pop());
__stack.length = __stack_sizes.pop();
__stack.push(function(child, parent) {
var __stack = [], __stack_sizes = [], __tmp;
function ctor() {
var __stack = [], __stack_sizes = [], __tmp;
__stack.push(child);
__stack.push(this);
__stack.push(__stack.pop().constructor = __stack.pop());
}
__stack.push(ctor);
__stack.push(parent);
for(var __tmp_lval in __stack.pop()) {
var key;
__stack.push(key = __tmp_lval);
__stack.push(key);
__stack.push(parent);
__stack.push(__hasProp);
__stack.push(__stack.pop().call(__stack.pop(), __stack.pop()));
if(__stack.pop()) {
__stack.push(key);
__stack.push(parent);
__stack.push(__stack.pop()[__stack.pop()]);
__stack.push(key);
__stack.push(child);
__stack.push(__stack.pop()[__stack.pop()] = __stack.pop());
} else {
}
}
__stack.push(parent);
__stack.push(__stack.pop().prototype);
__stack.push(ctor);
__stack.push(__stack.pop().prototype = __stack.pop());
__stack.push(ctor);
__tmp = __stack.pop();
__stack.push(new __tmp());
__stack.push(child);
__stack.push(__stack.pop().prototype = __stack.pop());
__stack.push(parent);
__stack.push(__stack.pop().prototype);
__stack.push(child);
__stack.push(__stack.pop().__super__ = __stack.pop());
__stack.push(child);
return __stack.pop();
});
var __extends;
__stack.push(__extends = __stack.pop());
__stack.push(function() {
var __stack = [], __stack_sizes = [], __tmp;
function Animal(name) {
var __stack = [], __stack_sizes = [], __tmp;
__stack.push(name);
__stack.push(this);
__stack.push(__stack.pop().name = __stack.pop());
}
__stack.push(Animal);
__stack.push(function(meters) {
var __stack = [], __stack_sizes = [], __tmp;
__stack.push("m.");
__stack.push(meters);
__stack.push(" moved ");
__stack.push(this);
__stack.push(__stack.pop().name);
__stack.push(__stack.pop() + __stack.pop());
__stack.push(__stack.pop() + __stack.pop());
__stack.push(__stack.pop() + __stack.pop());
__stack.push(alert);
__stack.push(__stack.pop()(__stack.pop()));
return __stack.pop();
});
__stack.push(Animal);
__stack.push(__stack.pop().prototype);
__stack.push(__stack.pop().move = __stack.pop());
__stack.push(Animal);
return __stack.pop();
});
__stack.push(__stack.pop()());
__stack.push(Animal = __stack.pop());
__stack.push(function() {
var __stack = [], __stack_sizes = [], __tmp;
function Snake() {
var __stack = [], __stack_sizes = [], __tmp;
__stack.push(arguments);
__stack.push(this);
__stack.push(Snake);
__stack.push(__stack.pop().__super__);
__stack.push(__stack.pop().constructor);
__stack.push(__stack.pop().apply(__stack.pop(), __stack.pop()));
}
__stack.push(Snake);
__stack.push(Animal);
__stack.push(Snake);
__stack.push(__extends);
__stack.push(__stack.pop()(__stack.pop(), __stack.pop()));
__stack.push(function() {
var __stack = [], __stack_sizes = [], __tmp;
__stack.push("Slithering...");
__stack.push(alert);
__stack.push(__stack.pop()(__stack.pop()));
__stack.push(5.0);
__stack.push(this);
__stack.push(Snake);
__stack.push(__stack.pop().__super__);
__stack.push(__stack.pop().move);
__stack.push(__stack.pop().call(__stack.pop(), __stack.pop()));
return __stack.pop();
});
__stack.push(Snake);
__stack.push(__stack.pop().prototype);
__stack.push(__stack.pop().move = __stack.pop());
__stack.push(Snake);
return __stack.pop();
});
__stack.push(__stack.pop()());
__stack.push(Snake = __stack.pop());
__stack.push(function() {
var __stack = [], __stack_sizes = [], __tmp;
function Horse() {
var __stack = [], __stack_sizes = [], __tmp;
__stack.push(arguments);
__stack.push(this);
__stack.push(Horse);
__stack.push(__stack.pop().__super__);
__stack.push(__stack.pop().constructor);
__stack.push(__stack.pop().apply(__stack.pop(), __stack.pop()));
}
__stack.push(Horse);
__stack.push(Animal);
__stack.push(Horse);
__stack.push(__extends);
__stack.push(__stack.pop()(__stack.pop(), __stack.pop()));
__stack.push(function() {
var __stack = [], __stack_sizes = [], __tmp;
__stack.push("Galloping...");
__stack.push(alert);
__stack.push(__stack.pop()(__stack.pop()));
__stack.push(45.0);
__stack.push(this);
__stack.push(Horse);
__stack.push(__stack.pop().__super__);
__stack.push(__stack.pop().move);
__stack.push(__stack.pop().call(__stack.pop(), __stack.pop()));
return __stack.pop();
});
__stack.push(Horse);
__stack.push(__stack.pop().prototype);
__stack.push(__stack.pop().move = __stack.pop());
__stack.push(Horse);
return __stack.pop();
});
__stack.push(__stack.pop()());
__stack.push(Horse = __stack.pop());
__stack.push("Sammy the Python");
__stack.push(Snake);
__tmp = __stack.pop();
__stack.push(new __tmp(__stack.pop()));
__stack.push(sam = __stack.pop());
__stack.push("Tommy the Palomino");
__stack.push(Horse);
__tmp = __stack.pop();
__stack.push(new __tmp(__stack.pop()));
__stack.push(tom = __stack.pop());
__stack.push(sam);
__stack.push(__stack.pop().move());
__stack.push(tom);
__stack.push(__stack.pop().move());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment