Profile cover photo
Profile photo
Maga D. Zandaqo
677 followers
677 followers
About
Maga D.'s posts

Post has attachment
At first sight using getters for "lazy" initialization of heavy properties looks interesting:
function Element() {}
// lazy boosted getter
Object.defineProperty(
  // per each instance
  Element.prototype,
  // when children property is accessed
  "children", {
  get: function () {
    // redefine it with the array
    // dropping the inherited getter
    return Object.defineProperty(
      // and setting it as own property
      this, "children", {value: []}
    ).children;
  }
});
// example
var el = new Element;
// later on, when/if necessary
el.children.push(otherElement);

But I think it might break hidden classes, used in V8, and end up being not so good for performance. In a similar situation, when some instances might have a heavy property, I would try to go with a "subclass" for them if possible. What do you think, guys?

Post has attachment
Speaking on type checking in +JavaScript. There's much hype about TypeScript and, as with Dart, one of its selling points is optional typing and type checking which is said to be much needed in JavaScript. But hey, "we've been having it!". If you need type checking in JavaScript use Google Closure Compiler and its JSDoc annotations. I for one am enjoying real time type checking right now in WebStorm 5.0: http://goo.gl/w1FkM

Post has attachment
Good News, Everyone!
node-mongodb-native is now officially supported by 10gen as MongoDB +node.js driver!

Post has attachment

[ #javascript ]

Fellow brogrammers, do/did you read JavaScript books? If so, vote for your favorite ones here: http://goo.gl/x73V7; otherwise, this list can be a good start: http://goo.gl/UL9yR

Let me paraphrase a Bill Bryson's quote: “It's a charitable irony that a language that succeeded almost by stealth, treated for decades as inadequate and second rate tongue of html-coders, should one day become the most important and successful language in the world.”

“They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.” — Benjamin Franklin

Post has shared content
I always suspected this might happen

Post has attachment
So, the next big thing is halal vodka I suppose.

Post has attachment
There can be only one.
#nodejs vs #RoR
Wait while more posts are being loaded