Skip to content

Instantly share code, notes, and snippets.

View MoonTahoe's full-sized avatar

Alex Banks MoonTahoe

View GitHub Profile
@MoonTahoe
MoonTahoe / actions.js
Last active October 13, 2017 23:36
Exercise: Redux Color Organizer
import C from './constants'
import { v4 } from 'uuid'
export const addColor = (title, color) =>
({
type: C.ADD_COLOR,
id: v4(),
title,
color,
timestamp: new Date().toString()
import React, { Component } from 'react'
import storeFactory from './store'
import { loadLifts, changeLiftStatus } from './actions'
import './App.css'
const StatusCircle = ({status, selected=false, onSelect=f=>f}) =>
<div className={selected ? `${status} selected` : status} onClick={() => onSelect(status)}/>
const StatusIndicator = ({currentStatus, onStatusChange=f=>f}) =>
['open', 'hold', 'closed'].map(
@MoonTahoe
MoonTahoe / color-organizer.css
Created October 15, 2017 03:40
The ui components and styles for the color organizer
html, body, div#react-container {
height: 100%;
min-height: 100%; }
h1 {
margin: 0;
padding: 0; }
body {
margin: 0;
@MoonTahoe
MoonTahoe / .babelrc
Created October 16, 2017 02:33
Server Render Recipes Start Files
{
"presets": [
"env",
"stage-0",
"react"
]
}
td:last-child {
padding: 5px;
width: 100px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-around;
}
td div {
@MoonTahoe
MoonTahoe / machine.js
Last active November 13, 2019 20:23
Generated by XState Viz: https://xstate.js.org/viz
const lightBulbMachine = Machine({
id: 'light',
initial: 'unlit',
context: {
color: "blue"
},
states: {
lit: {
on: {
TOGGLE:'unlit',
@MoonTahoe
MoonTahoe / machine.js
Last active November 14, 2019 00:47
Generated by XState Viz: https://xstate.js.org/viz
const tahoeTravelMachine = Machine({
id: 'tahoe-travel',
initial: 'walking',
states: {
walking: {
on: {
THUMBS_UP: 'hitchhiking',
ARRIVE: 'arrived'
}
},
@MoonTahoe
MoonTahoe / machine.js
Created November 14, 2019 01:40
Generated by XState Viz: https://xstate.js.org/viz
const walk = assign({
distance: (context, event) => context.distance - 1
});
const ride = assign({
distance: (context, event) => context.distance - 5
})
const hasArrived = (context, event) => context.distance <= 0;
@MoonTahoe
MoonTahoe / machine.js
Created November 14, 2019 03:17
Generated by XState Viz: https://xstate.js.org/viz
const seedToSale = Machine({
id: "canabis-regulation",
initial: "idle",
states: {
idle: {
on: {
TAG_RECEIVED: "seed"
}
},
seed: {
Feature: Timing an Agenda
As a Leader I want to time my agendas
so that I can know how long it really takes
to run my agendas
Background:
Given the following agenda:
| HOW TO CAMP | time |
| What is camping? | 3 min |
| History of camping | 2 min |