Skip to content

Instantly share code, notes, and snippets.

View jsteinbeck's full-sized avatar

J Steinbeck jsteinbeck

View GitHub Profile
@jsteinbeck
jsteinbeck / story.trot.md
Last active January 3, 2018 13:10
Cloak of Darkness written in Toothrot

Cloak of Darkness

default

(#) background: "linear-gradient(to bottom, rgba(230, 230, 230, 1) 0, rgba(140, 140, 140, 1) 30%, rgba(0, 0, 0, 1) 95%)"

start

(#) autonext: 7000

@jsteinbeck
jsteinbeck / multimethods-dispatch-typeof-example.js
Created November 10, 2015 17:31
Custom multimethod dispatch using the typeof operator (ENJOY.js)
var method = require("enjoy-js").method;
var dispatch = require("enjoy-js").dispatch;
var specialize = require("enjoy-js").specialize;
var concat = method();
dispatch(concat, type_of, type_of);
specialize(concat, "string", "string", function (a, b) {
return a + b;
@jsteinbeck
jsteinbeck / multimethods-example.js
Created November 10, 2015 17:25
Example for using ENJOY.js multimethods
var method = require("enjoy-js").method;
var specialize = require("enjoy-js").specialize;
var is_object = require("enjoy-js").is_object;
var is_string = require("enjoy-js").is_string;
// Defining a multimethod with a default implementation:
var hello = method(function () {
return "Hello!";
});
/* global window */
function StageResizer (stageElement, options) {
options = options || {};
this._element = stageElement;
this._stageWidth = options.stageWidth || stageElement.offsetWidth || 1;
this._stageHeight = options.stageWidth || stageElement.offsetWidth || 1;
this._snapToEdge = options.snapToEdge || true;