Skip to content

Instantly share code, notes, and snippets.

View danielocampo2's full-sized avatar

Daniel Ocampo danielocampo2

  • Remote
View GitHub Profile
@devboell
devboell / TestProvider.js
Last active August 13, 2018 05:15
apollo integration testing approach
// test-utils/index.js
// for convenience wrap apollo and redux providers in one Provider component
import React from 'react'
import pt from 'prop-types'
import { MockedProvider } from 'react-apollo/test-utils'
import { Provider } from 'react-redux'
import { createStore } from 'redux'
@andymatuschak
andymatuschak / States-v3.md
Last active May 1, 2024 12:32
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing