Skip to content

Instantly share code, notes, and snippets.

From 263700b42d405f4c5330406511f0720f79f6f353 Mon Sep 17 00:00:00 2001
From: Peter Schilling <peter@tanookilabs.com>
Date: Thu, 10 Aug 2023 16:45:56 -0700
Subject: [PATCH] React
---
.../{application.ts => application.tsx} | 14 ++++++++++++++
app/views/layouts/application.html.erb | 2 +-
package.json | 4 ++++
3 files changed, 19 insertions(+), 1 deletion(-)
@schpet
schpet / FancyFileInput.tsx
Last active December 16, 2021 00:39
React component for adding and removing files from Active Record's `has_many_attached`. assumes imgix is used.
import { DirectUpload } from "@rails/activestorage"
import React, { useRef, useState } from "react"
import Imgix, { ImgixProvider } from "react-imgix"
import { withBasics } from "./withBasics"
export interface Props {
name: string
directUploadUrl: string
attachments: Attachment[]
imgixSource: string
@schpet
schpet / machine.js
Created July 28, 2021 17:36
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@schpet
schpet / machine.js
Created July 27, 2021 22:21
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@schpet
schpet / machine.js
Created May 6, 2021 01:49
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@schpet
schpet / machine.js
Created April 14, 2021 21:29
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@schpet
schpet / machine.js
Created March 24, 2021 16:24
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@schpet
schpet / machine.js
Created March 2, 2021 21:40
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@schpet
schpet / machine.js
Created February 8, 2021 16:58
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@schpet
schpet / machine.js
Created December 14, 2020 06:08
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions