Skip to content

Instantly share code, notes, and snippets.

var crypto = require('crypto');
var obj = new Object(),
i = 0,
key,
body,
selectedKeys = [];
console.log("Starting generation");
console.time("GENERATION");
for (i; i < 100000; i++) {
key = "key_" + i + "_" + crypto.createHash('md5').update(i + "aaaa" + Date.now()).digest("hex");
// ################################# PCLASS
function wrap(method, superMethod){
//check if supetMethod actualy has any parent call
if (method.toString().match(/.+\.parent\(.+/)) {
return function(){
this.parent = superMethod;
var result = method.apply(this, arguments);
delete this.parent;
return result;
};
// ################################# CLASS
function Class( fn ){
var object = new fn(), nc = fn, superObject;
if(object.hasOwnProperty('initialize')){
fn = object.initialize;
//delete object.initialize;
}
if(object.hasOwnProperty('Extends')){
var SuperConstructor = object.Extends;
delete object.Extends;
// ################################# CLASS
function Class( fn ){
var object = new fn(), nc = fn, superObject;
if(object.hasOwnProperty('initialize')){
fn = object.initialize;
}
if(object.hasOwnProperty('Extends')){
var SuperConstructor = object.Extends;
delete object.Extends();
fn.prototype = new SuperConstructor();
@artifi
artifi / Class.js
Created November 15, 2011 20:29
Basic Class implementation
exports.Class = function(object){
//real konstructor
var newClass = function() {
if(this.__proto__.initialize){
var that = this.__proto__.initialize.apply(this, arguments);
return that
}
return this;
}
//obsluga dziedziczenia
@artifi
artifi / Class.js
Created November 15, 2011 20:29
Basic Class implementation
exports.Class = function(object){
//real konstructor
var newClass = function() {
if(this.__proto__.initialize){
var that = this.__proto__.initialize.apply(this, arguments);
return that
}
return this;
}
//obsluga dziedziczenia