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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>👊✋✌️</title> | |
<style> | |
/* RESET */ | |
* { | |
margin: 0; | |
padding: 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
#!/usr/bin/env node | |
var path = require('path') | |
var parse = require('minimist') | |
var browserify = require('browserify') | |
var args = parse(process.argv.slice(2)) | |
var entries = args._ | |
var output = args.o || args.output | |
var main = args.m || args.main | |
var url = args.url || output |
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
function remove (state, data) { | |
var active = state.active.concat() | |
var i = 0 | |
var l = active.length | |
var item | |
for (i; i<l; i++) { | |
item = active[i] | |
if (item.id === data.id) { | |
break | |
} |
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
function update (state, data) { | |
var active = state.active.concat() | |
var i = 0 | |
var l = active.length | |
var item | |
for (i; i<l; i++) { | |
item = active[i] | |
if (item.id === data.id) { | |
active[i] = data | |
break |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Fixed header</title> | |
<style> | |
.container { | |
display: flex; | |
flex-direction: column; | |
position: absolute; |
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
function debounce (fn, wait) { | |
var timeout | |
return function () { | |
var context = this | |
var args = Array.prototype.slice.call(arguments) | |
var later = function () { | |
timeout = null | |
fn.apply(context, args) | |
} | |
clearTimeout(timeout) |
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 html = require('yo-yo') | |
module.exports = function Component () { | |
var currentState | |
var element | |
function render (state) { | |
if (!element) { | |
currentState = state | |
return element = create(currentState) |
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 html = require('yo-yo') | |
module.exports = function View (store) { | |
var currentState = store.getState() | |
var subscribe = store.subscribe | |
var unsubscribe | |
var element | |
function load () { | |
unsubscribe = subscribe(update) |
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
function walk(n, o, update, target) { | |
tree = update(n, o, target) | |
n = n.firstChildElement | |
o = o.firstChildElement | |
target = tree.firstChildElement | |
while (n || o) { | |
walk(n, o, update) | |
n = n.nextElementSibling | |
o = n.nextElementSibling | |
} |
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 html = require('bel') | |
var nanomorph = require('nanomorph') | |
var cache = require('cache-element') | |
var stuff = [ | |
[{ | |
title: 1 | |
}, { | |
title: 2 | |
}, { | |
title: 3 |