Just saw Douglas Crockfords talk at Craft Conference
http://www.ustream.tv/recorded/46640057
Just tried it and must say, it has a certain beauty in it.
No tangeling with prototypes and this/that fuckup.
var Animal = function(name, legs) {
// example using the raf module from npm. try changing some values! | |
var requestAnimationFrame = require("raf") | |
var canvas = document.createElement("canvas") | |
canvas.width = 500 | |
canvas.height = 500 | |
document.body.appendChild(canvas) | |
var context = canvas.getContext("2d") |
var AmpersandState = require('ampersand-state'); | |
var Ingredient = AmpersandState.extend({ | |
props: { | |
name: 'string' | |
} | |
}); | |
var Meal = AmpersandState.extend({ | |
props: { |
var express = require('express'); | |
function base(content) { | |
return [ | |
'<!doctype html>', | |
'<html>', | |
'<head>', | |
'<link href="/index.css" media="all" rel="stylesheet" type="text/css">', | |
'<link href="/latin/firasans-bold,firasans-hair,firasans-light,firasans-book,firasans-italic,firamono-bold/fonts.css" type="text/css" rel="stylesheet"/ >', | |
'<script src="/index.js"></script>', |
"use strict"; | |
/* | |
Formatters | |
Usage: | |
f.append(f.trim(' foo '), 'bar') > foobar | |
With composition |
"use strict"; | |
/* | |
Chainable formatters | |
Usage: | |
function trim(value) { | |
return value.trim(); | |
} |
const directions = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]; | |
function evolve(currentCells) { | |
const equalTo = (a) => (b) => a[0] === b[0] && a[1] === b[1]; | |
const isCurrentlyAlive = (cell) => currentCells.some(equalTo(cell)); | |
const add = (a) => (b) => [a[0] + b[0], a[1] + b[1]] | |
const neighboursOf = (cell) => directions.map(add(cell)); | |
const notIn = (list) => (item) => !list.some(equalTo(item)); | |
const countNeighbours = (cell) => neighboursOf(cell).filter(isCurrentlyAlive).length; | |
'use strict'; | |
var bus = require('./bus'); | |
var throttle = require('lodash/function/throttle'); | |
function getOffsetX(event) { | |
return event.offsetX || event.layerX; | |
} | |
function getOffsetY(event) { |
Just saw Douglas Crockfords talk at Craft Conference
http://www.ustream.tv/recorded/46640057
Just tried it and must say, it has a certain beauty in it.
No tangeling with prototypes and this/that fuckup.
var Animal = function(name, legs) {
'use strict'; | |
var m = require('mithril'); | |
var extend = require('lodash').extend; | |
var setFocus = require('../util/viewhelper').setFocus; | |
var keymage = require('keymage'); | |
function noop(){} | |
function addClass(el, className) { |
var styler = require('./styler'); | |
function mainView() { | |
return [ | |
styler.view(), | |
//... | |
]; | |
} |