Skip to content

Instantly share code, notes, and snippets.

@JulianG
JulianG / machine.js
Created October 6, 2019 20:39
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@JulianG
JulianG / escape-the-mines.ts
Last active November 11, 2019 15:04
Daily Challenge #107 - Escape the Mines
// Daily Challenge #107 - Escape the Mines
// A poor miner is trapped in a mine and you have to help him to get out!
// The mine is completely dark so you have to tell him where to go.
// https://dev.to/thepracticaldev/daily-challenge-107-escape-the-mines-2036
// Based on: https://www.redblobgames.com/pathfinding/a-star/introduction.html
// by @redblobgames
@JulianG
JulianG / machine.js
Last active December 30, 2019 09:37
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@JulianG
JulianG / createStrictContext.js
Created August 9, 2020 14:07
Create React Strict Context
import React from 'react';
export function createStrictContext(options = {}) {
const Context = React.createContext(undefined);
Context.displayName = options.name;
function useContext() {
const context = React.useContext(Context);
if (!context) {
throw new Error(options.errorMessage || `${name || ''} Context Provider is missing`);
}