Skip to content

Instantly share code, notes, and snippets.

@alavkx
alavkx / machine.js
Created August 10, 2020 21:48
Generated by XState Viz: https://xstate.js.org/viz
const fetchQuizData = () =>
fetch(
`https://opentdb.com/api.php?amount=10&difficulty=hard&type=boolean`,
).then(response => response.json())
const normalizeQuizData = (data) =>
data.reduce(
(acc, obj) => [
...acc,
{
@alavkx
alavkx / Player.re
Created September 15, 2019 22:51
Audio player state model
type progress =
| Stopped
| Playing
| Rewinding
| FastForwarding
| Paused;
type playerState = {
status: progress,
activeTrackIndex: option(int),
};
@alavkx
alavkx / App.re
Created September 15, 2019 18:57
Find the bug!
type track = {
name: string,
artist: string,
};
let tracks = [|
{artist: "Kromestar", name: "007"},
{artist: "Kromestar", name: "008"},
{artist: "Kromestar", name: "009"},
{artist: "Kromestar", name: "010"},
{artist: "Kromestar", name: "011"},