Skip to content

Instantly share code, notes, and snippets.

@barbados-clemens
barbados-clemens / change-config-transformer.spec.ts
Last active July 14, 2022 13:39
Work in making a ts transformer for updating the cypress.config.ts file for nrwl. Ended up not using but wanted to keep around as a ref (Thanks for the help building this Chau!)
import { CypressConfigTransformer } from './change-config-transformer';
describe('Update Cypress Config', () => {
const defaultConfigContent = `
import { defineConfig } from 'cypress';
import { nxComponentTestingPreset } from '@nrwl/react/plugins/component-testing';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
export default defineConfig({
@barbados-clemens
barbados-clemens / machine.js
Last active August 19, 2020 21:26
Generated by XState Viz: https://xstate.js.org/viz
//https://xstate.js.org/viz/?gist=4a78aae66feab67f9e90be4423a672da
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@barbados-clemens
barbados-clemens / machine.js
Last active February 9, 2020 04:46
Generated by XState Viz: https://xstate.js.org/viz
// https://xstate.js.org/viz/?gist=e65afa5c88dcc41657771b85e4142da6
const saveSelection = assign({
available: (ctx, event) => {
console.log('available', ctx.available);
// do some logic in here to verify selection
ctx.available.splice(0, 1);
return ctx.available;
},
selected: (ctx, event) => {
@barbados-clemens
barbados-clemens / machine.js
Last active February 9, 2020 03:30
Generated by XState Viz: https://xstate.js.org/viz
// https://xstate.js.org/viz/?gist=0954f3bbb0b4cb2c98d486540a7f4ef2
// import {assign, Machine} from 'xstate';
// interface DraftContext {
// currentUser: string;
// users: string[];
// elapsed: number;
// duration: number;
// round: number;
// interval: number;
@barbados-clemens
barbados-clemens / machine.js
Last active February 9, 2020 00:27
Generated by XState Viz: https://xstate.js.org/viz
// https://xstate.js.org/viz/?gist=dbff7ab7affae922b6bc0ca461906a01
// {
// "type": "USER_ADD",
// "user": {
// "name": "something",
// "isPending": true,
// "drafted": []
// }
// }
// Tutorial from docsk
// https://xstate.js.org/docs/tutorials/reddit.html#modeling-the-app
// Sample SELECT Event
const selectEvent = { type: 'SELECT', name: 'reactjs' };
const invokeFetchSubreddit = context => {
const {subreddit} = context;
return fetch(`https://www.reddit.com/r/${subreddit}.json`)
@barbados-clemens
barbados-clemens / machine.js
Last active February 4, 2020 14:50
Generated by XState Viz: https://xstate.js.org/viz
// https://xstate.js.org/viz/?gist=917b7d0c4992306057067c08166fdb7d
const playingEffect = actions.assign(
ctx => ({
pos: ctx.pos + 1
})
);
const forwardingEffect = actions.assign(
ctx => ({