Skip to content

Instantly share code, notes, and snippets.

View mellson's full-sized avatar
🏡

Anders Bech Mellson mellson

🏡
View GitHub Profile
import { createMachine, actions } from "xstate";
const { raise } = actions;
// Demostrate `raise` action
const raiseActionDemo = createMachine({
id: 'Raise action demo',
initial: 'entry',
states: {
entry: {
on: {
@mellson
mellson / raiseActionDemo.js
Last active January 3, 2023 09:44
XState raise action demo
import { createMachine, actions } from "xstate";
const { raise } = actions;
// Demonstrate `raise` action
const raiseActionDemo = createMachine({
id: 'Raise action demo',
initial: 'entry',
states: {
entry: {
on: {
@mellson
mellson / transpileRescriptRelay.js
Last active May 13, 2021 10:39
script to transpile ReScript Relay files to TypeScript components - call it with a src and destination. Example `node transpileRescriptRelay.js src/rescript src/rescript_dummy_ts_components`
var fs = require("fs")
if (process.argv.length < 4)
throw new Error("You need to provide a path to both source and destination")
const source = process.argv[2]
const destination = process.argv[3]
const fileType = process.argv[4] ?? "ts"
const relayFragmentIdentifiers = ["%relay", "fragment"]
@mellson
mellson / xstatesvelte.ms
Last active August 23, 2020 18:38
XState Svelte starter node problem
I have a problem when I export the [XState + Svelte starter](https://codesandbox.io/s/xstate-svelte-template-jflv1) to a zip file and run it on my mac.
I get this error in my console: `Uncaught ReferenceError: process is not defined`.
From [this PR](https://github.com/davidkpiano/xstate/pull/1169) I found that I can make it work by adding `rollup-plugin-inject-process-env` to package.json.
After adding that to the package.json I add this config change to rollup.config.js:
`export default {
...
plugins: [
...
@mellson
mellson / keybase.md
Last active August 9, 2017 06:37
Keybase Proof

Keybase proof

I hereby claim:

  • I am mellson on github.
  • I am mellson (https://keybase.io/mellson) on keybase.
  • I have a public key whose fingerprint is FBCA AF63 0ADD 7220 9AD2 E39C 5141 FB5A E8F5 2210

To claim this, I am signing this object: