made with requirebin
Created
June 28, 2014 19:29
-
-
Save danro/8b2726653fc41cf9b5c4 to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mash = require('mash-js'); | |
function Animal() {} | |
mash(Animal, function() { | |
this.init = function(name) { | |
this.name = name; | |
}; | |
this.move = function(meters) { | |
console.log(this.name + ' moved ' + meters + 'm.'); | |
}; | |
}); | |
function Snake() {} | |
mash(Snake, function () { | |
var supr = Animal.mash(this); | |
this.move = function() { | |
console.log('Slithering...'); | |
supr.move.call(this, 5); | |
}; | |
}); | |
function Horse() {} | |
mash(Horse, function () { | |
var supr = Animal.mash(this); | |
this.move = function() { | |
console.log('Galloping...'); | |
supr.move.call(this, 45); | |
}; | |
}); | |
var sam = Snake.create('Sammy the Python'); | |
var tom = Horse.create('Tommy the Palomino'); | |
sam.move(); | |
tom.move(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({"yw/lAm":[function(require,module,exports){function mash(base,mixin){if(!mixin){mixin=base;base={}}var proto=base.prototype;if(proto==={}.prototype)proto=base;mixin.call(proto);base.create=function(){var ctor=base;if(typeof ctor!=="function"){ctor=function(){};ctor.prototype=base}var inst=new ctor;if(typeof inst.init==="function"){inst.init.apply(inst,arguments)}return inst};base.mash=function(obj){mixin.call(obj);return proto};return base}module.exports=mash},{}],"mash-js":[function(require,module,exports){module.exports=require("yw/lAm")},{}]},{},[]);var mash=require("mash-js");function Animal(){}mash(Animal,function(){this.init=function(name){this.name=name};this.move=function(meters){console.log(this.name+" moved "+meters+"m.")}});function Snake(){}mash(Snake,function(){var supr=Animal.mash(this);this.move=function(){console.log("Slithering...");supr.move.call(this,5)}});function Horse(){}mash(Horse,function(){var supr=Animal.mash(this);this.move=function(){console.log("Galloping...");supr.move.call(this,45)}});var sam=Snake.create("Sammy the Python");var tom=Horse.create("Tommy the Palomino");sam.move();tom.move(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"mash-js": "0.9.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; } | |
body, html { height: 100%; width: 100%; }</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment