Skip to content

Instantly share code, notes, and snippets.

@hackervera
Created August 1, 2010 10:08
Show Gist options
  • Save hackervera/503187 to your computer and use it in GitHub Desktop.
Save hackervera/503187 to your computer and use it in GitHub Desktop.
Hipster javascript
require('./MooTools').apply(GLOBAL);
var sys = require('sys');
var Human = new Class({
eat: function() { this.energy++; },
drink: function(target){ target.open(); }
});
var Beer = new Class({
initialize: function(brewer, age){
this.brewer = brewer;
this.age = age;
}
});
var Can = new Class({
open: function(){ console.log("You break the seal with the tab, gotta love that sound"); },
});
var PBR = new Class({
Extends: Beer,
Implements: Can
});
tyler = new Human();
tyler.drink(new PBR());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment