Skip to content

Instantly share code, notes, and snippets.

View gingi's full-sized avatar

Shiran Pasternak gingi

View GitHub Profile

Keybase proof

I hereby claim:

  • I am gingi on github.
  • I am gingi (https://keybase.io/gingi) on keybase.
  • I have a public key whose fingerprint is C424 40E5 6E66 6C90 77DE DFA1 BE43 7FBF 0328 C918

To claim this, I am signing this object:

@gingi
gingi / inherit.js
Last active August 29, 2015 14:08
A method for generically inheriting classes. Supports strict mode, and the ability to instantiate objects with and without the `new` keyword. Combines ideas from Douglas Crockford and John Resig.
/**
* @method inherit
*
* Creates a new Class. Implements the necessary wiring to ensure a valid
* prototype chain. Returns an object constructor which can be used to
* instantiate new objects. The method accepts two optional parameters: (1) a
* parent class from which to inherit, and (2) a set of methods. An
* `initialize` method can be specified which will be called automatically upon
* object instantiation.
*