Skip to content

Instantly share code, notes, and snippets.

View BenjaminVerble's full-sized avatar

Benjamin Verble BenjaminVerble

View GitHub Profile
@BenjaminVerble
BenjaminVerble / index.js
Created April 11, 2016 16:49
requirebin sketch
const morphdom = require('morphdom')
const h = require('hyperscript')
const {createStore, bindActionCreators, applyMiddleware} = require('redux')
const xtend = require('xtend')
const thunk = require('redux-thunk').default
const domify = require('domify')
const reducer = (state, action) => (
action.type === 'increment' ? { count: state.count + 1} :
action.type === 'decrement' ? { count: state.count + 1} :
@BenjaminVerble
BenjaminVerble / index.js
Created April 7, 2016 20:45
requirebin sketch
const morphdom = require('morphdom')
const h = require('hyperscript')
const {createStore, bindActionCreators, applyMiddleware} = require('redux')
const xtend = require('xtend')
const thunk = require('redux-thunk').default
const reducer = (state, action) => (
action.type === 'increment' ? { count: state.count + 1} :
action.type === 'decrement' ? { count: state.count + 1} :
state
@BenjaminVerble
BenjaminVerble / index.js
Last active April 7, 2016 16:58
requirebin sketch
const morphdom = require('morphdom')
const h = require('hyperscript')
const sendAction = require('send-action')
const xtend = require('xtend')
const createMorphdomUpdater = ($el) => (thing1, thing2) => morphdom(thing1, thing2)
let send;
const $root = document.getElementById('root')
@BenjaminVerble
BenjaminVerble / index.js
Created March 17, 2016 22:03
requirebin sketch
const yo = require('yo-yo')
const createStore = require('store-emitter')
const xtend = require('xtend')
function modifier (action, state) {
if (action.type === 'change_name') {
return { name: action.payload }
}
}
@BenjaminVerble
BenjaminVerble / index.js
Created March 8, 2016 16:37
requirebin sketch
var p = require('preact');
var h = p.h;
var App = function(props) {
function onclick() {
alert(props.message);
}
return h('header', null,
@BenjaminVerble
BenjaminVerble / after.json
Last active February 4, 2016 20:19
xdat example
{
"44085caf-1479-41c6-bb27-a7c33cf43917": {
"id": "44085caf-1479-41c6-bb27-a7c33cf43917",
"name": "Ann Cook",
"birthday": "6/14/2015",
"size": "XL",
"procedure": [
"4990f95f-e7f3-456b-9137-05cd3089b06a"
],
"car": "df448beb-4780-4cee-b2f7-2c99ca5a20a1",
@BenjaminVerble
BenjaminVerble / index.html
Created January 12, 2016 19:59
web developer starter kit 2016. one-upping the competition!
<!DOCTYPE html>
<html>
<head>
<title>Develop the Webz!</title>
<style type="text/css">
body {
background: purple;
color: orange;
}
</style>
@BenjaminVerble
BenjaminVerble / index.js
Created December 29, 2015 21:25
virtual-app bug maybe ?
var extend = require('xtend')
var vdom = require('virtual-dom')
var createApp = require('virtual-app')
/*
* create the app passing the container element and virtual-dom
*/
const app = createApp(document.body, vdom)
const h = app.h
/*
@BenjaminVerble
BenjaminVerble / README.md
Created December 29, 2015 00:50 — forked from HenrikJoreteg/README.md
Minimalist routing in Redux

Why would you want to do this? Because you often don't need more. It's nice to not have to think about your "router" as this big special thing.

Instead, with this approch, your app's current pathname is just another piece of state, just like anything else.

This also means that when doing server-side rendering of a redux app, you can just do:

var app = require('your/redux/app')
var React = require('react')
@BenjaminVerble
BenjaminVerble / hyperscript-class-composer.js
Last active December 28, 2015 19:08
to be used with plain css file and virtual-dom/hyperscript
'use strict'
var h = require('hyperscript')
// String -> String
const button = option => {
var base = 'button.btn'
return typeof option === 'string' ?
`${base}.btn-${option}` :
base
}