Skip to content

Instantly share code, notes, and snippets.

View sukima's full-sized avatar

Devin Weaver sukima

View GitHub Profile
@sukima
sukima / component.js
Last active July 8, 2020 21:10
ui-link-to Component OCTANE
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class UiLinkTo extends Component {
@service router;
get href() {
return this.router.urlFor(...this.route);
@sukima
sukima / machine.js
Last active June 18, 2020 00:46
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@sukima
sukima / components.booleans-example\.js
Last active July 20, 2022 19:59
Statecharts iterative example
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import mockFetch from '../utils/mock-fetch';
export default class extends Component {
@tracked state = 'idle';
@tracked isLoading = false;
@tracked hasSuccess = false;
@startuml
title Diceware+
state Bootstrap {
state "Booting" as Bootstrap.Booting
state "Done" as Bootstrap.Done
state "Error" as Bootstrap.Error
Bootstrap.Booting : invoke / fetchWords
Bootstrap.Booting --> Bootstrap.Done : //done// (fetchWords)
/* GistID: 984b1a0084e7cb21f5c8ac1409d31866 */
const EOL = Symbol('EOL');
const TOKENS = {
[EOL]: 'END_INPUT',
'{': 'OPEN_BRACE',
'}': 'CLOSE_BRACE',
'/': 'OPERATION',
'+': 'OPERATION',
@sukima
sukima / nombomb.bash
Created May 5, 2020 19:16
Forcfully remove old node_modules recursivly
#!/bin/bash
DIR="${1##/}"
DIR="${DIR-:.}"
entries=$(mktemp)
trap 'rm -f "$entries"' EXIT
find "${DIR}" -name node_modules -prune -atime +30d > "$entries"
@sukima
sukima / machine.js
Last active April 29, 2020 18:32
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@sukima
sukima / machine.js
Last active April 24, 2020 15:17
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@sukima
sukima / machine.js
Last active April 20, 2020 04:00
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@sukima
sukima / machine.js
Last active April 17, 2020 04:00
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'timer',
type: 'parallel',
context: {
goal: 5000,
nearOvertime: 10000,
overtime: 15000
},
states: {
clock: {