Skip to content

Instantly share code, notes, and snippets.

View Raynos's full-sized avatar

Jake Verbaten Raynos

View GitHub Profile
@Raynos
Raynos / index.js
Created May 26, 2014 04:01
requirebin sketch
var mercury = require("mercury")
var h = mercury.h
var events = mercury.input(["reset"])
var state = mercury.hash({
isReset: mercury.value(false),
events: events
})
@Raynos
Raynos / index.js
Created May 26, 2014 04:00
requirebin sketch
var mercury = require("mercury")
var h = mercury.h
var events = mercury.input(["change"])
var textValue = mercury.value("")
events.change(function (data) {
textValue.set(data.text)
})
@Raynos
Raynos / index.js
Created May 26, 2014 03:59
requirebin sketch
var mercury = require("mercury")
var h = mercury.h
var events = mercury.input(["height", "weight", "bmi"])
var bmiData = mercury.hash({
height: mercury.value(180),
weight: mercury.value(80),
bmi: mercury.value(calcBmi(180, 80))
})
@Raynos
Raynos / index.js
Created May 26, 2014 03:57
requirebin sketch
var GithubWidget = require('github-widget/element')
type VNode := {
tagName: String,
(* properties has a set of well defined
optional properties.
However it also has wildcard keys like
'data-foo': Any
and onfoo: Function
*)
var test = require('tape');
test('setup entire integration test', function (assert) {
series([
spawnRedis,
spawnChildProcess
], assert.end.bind(assert))
})
process.nextTick(function () {
cd ~/tmp
mkdir foo
cd foo
nvm use 0.8.26
npm init
npm i request -S --verbose # hangs

Understanding web components

The web components spec says there are four parts

  • templates
  • custom elements
  • shadow dom
  • html imports

disclaimer: I might be terribly wrong. This is a set of naive observations.

@Raynos
Raynos / x.js
Last active August 29, 2015 14:00
// foldp := (Signal<A>, (B, A) => B, B) => Signal<B>
function foldp(source, lambda, initial) {
var result = Signal(initial)
source.listen(function (ev) {
result.set(lambda(result.get(), ev))
})
return result
}

Shrinkwrap work flows

The problem

For any node application there are two sources of truth for what the dependency tree should look like:

  • package.json
  • node_modules/