Skip to content

Instantly share code, notes, and snippets.

@grommett
grommett / machine.js
Last active May 31, 2020 16:05
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@grommett
grommett / index.js
Created November 30, 2018 05:19
Simple viperHTML Usage
const express = require('express');
const viperhtml = require('viperhtml');
const app = express();
const port = 3000;
const render = viperhtml.wire();
app.get('/', (req, res) => {
const model = {
name: 'Morgan',
@grommett
grommett / convertFromHTML-result.json
Created April 12, 2017 19:06
Result of running Draft.js `convertFromHTML` with an `<img>` inside an `<a>` tag.
{
"contentBlocks": [
{
"key": "22lg9",
"type": "unstyled",
"text": "Bold text, Italic text\n",
"characterList": [
{
"style": [
"BOLD"
@grommett
grommett / Conditions.js
Created September 20, 2016 04:21
Conditional
//
const condition = (...args) => (val) => {
let result = args.filter((pair) => {
if(pair[0] === val) return true;
return false;
})
return result.length !==0 ? result[0][1] : undefined;
}