Skip to content

Instantly share code, notes, and snippets.

@ishiduca
ishiduca / app.js
Created June 29, 2018 10:15
snoopy-domain
const w = require('global/window')
const d = require('global/document')
const yo = require('yo-yo')
const css = require('sheetify')
const {pipe, through} = require('mississippi')
const {start} = require('@ishiduca/snoopy')
css('./css/bulma.css')
const root = yo`<div></div>`
@ishiduca
ishiduca / app_browser.js
Last active June 5, 2018 03:12
snoopy routing
const d = require('global/document')
const yo = require('yo-yo')
const router = require('./browser')
const {pipe, through} = require('mississippi')
const {start} = require('@ishiduca/snoopy')
const {views} = start(
router({
init () {
return {
model: {
'use strict'
const fs = require('fs')
const path = require('path')
const request = require('hyperquest')
const {pipe, through} = require('mississippi')
const input = path.join(__dirname, 'feeds/feed.txt')
const output = path.join(__dirname, 'feeds/feed-filtered.txt')
const headers = {'user-agent': 'feedr'}
@ishiduca
ishiduca / defaults.js
Created April 21, 2018 01:26
using observer instead of pull-stream on the Elmish architecture. #inu #tom
module.exports = {
init: function () { return {model: null} },
update: function (model, action) { return {model: model} },
view: function () { return null },
run: function () { return null }
}
var xtend = require('xtend')
module.exports = combine
function combine (a, b) {
return function () {
return xtend(a.apply(null, arguments), b.apply(null, arguments))
}
}
@ishiduca
ishiduca / defaults.js
Last active February 6, 2018 00:04
yo-yo + mississippi => shibainu
module.exports = {
init: init,
update: update,
view: view,
run: run
}
function init () { return {model: null} }
function update (model) { return {model: model} }
function view () { return null }
@ishiduca
ishiduca / api-message.js
Last active December 26, 2017 09:40
data を proxy
module.exports = (emitter, proxy) => {
emitter.on('updateMessage', mes => (proxy.message = mes))
}
var yo = require('yo-yo')
var xtend = require('xtend')
var types = {
button: 0,
checkbox: 0,
color: 0,
date: 1,
'datetime-local': 1,
email: 1,
file: 0,
@ishiduca
ishiduca / app.js
Last active December 20, 2017 06:44
example yo-yo-with-websocket
'use strict'
const path = require('path')
const http = require('http')
const xtend = require('xtend')
const valid = require('is-my-json-valid')
const validate = valid(require('./schema'))
const ecstatic = require('ecstatic')(path.join(__dirname, 'static'))
const websocket = require('websocket-stream')
const router = require('router-on-websocket-stream')
const r = router()
var yo = require('yo-yo')
var xtend = require('xtend')
var domCss = require('dom-css')
var ATTRIBUTES = {type: 'button'}
var STYLES = {cursor: 'pointer'}
module.exports = button
function button (content, _opt, _onclick) {