Skip to content

Instantly share code, notes, and snippets.

View JosephScript's full-sized avatar
💭
🚀 Changed my handle to @JosephScript!

Joseph A. Szczesniak JosephScript

💭
🚀 Changed my handle to @JosephScript!
View GitHub Profile
@JosephScript
JosephScript / server.ts
Created March 8, 2024 16:46
fastify-hocuspocus
import { Server } from '@hocuspocus/server'
import Fastify from 'fastify'
import WebSocketPlugin from 'fastify-websocket'
const port = Number(process.env.PORT || 8800)
const host = '0.0.0.0'
// Initialize Fastify
const fastify = Fastify()
@JosephScript
JosephScript / generateEditorJson.ts
Created July 26, 2024 19:23
CraftJS generateEditorJson with only JSON
import { ROOT_NODE, UserComponent } from '@craftjs/core'
import { getRandomId } from '@craftjs/utils'
// We can infer the NodeConfig type from the UserComponent's props
type NodeConfig<T extends UserComponent> = {
node: T
props: React.ComponentProps<T>
}