Skip to content

Instantly share code, notes, and snippets.

View smashboy's full-sized avatar
🌴

SmashBoy smashboy

🌴
View GitHub Profile
@smashboy
smashboy / thingy.ts
Last active December 10, 2023 20:27
Thingy.JS
type StateValue = Record<string | symbol, any>;
type Child = ElementBase<any> | string | number | boolean | null | undefined;
type Children = Child[];
type ElementInternalChild = (() => Child) | Child;
type ElementInternalChildren = ElementInternalChild[];
type ElementListener<K extends keyof HTMLElementEventMap> = {
callback: (event: HTMLElementEventMap[K]) => void;
@smashboy
smashboy / seed.ts
Created June 7, 2023 11:01
Prisma seed
import * as dotenv from "dotenv";
import {
type DestinyManifestLanguage,
getDestinyManifest,
getDestinyManifestSlice,
} from "bungie-api-ts/destiny2";
import { bungieApiFetchHelper } from "~/bungie/fetchHelper";
import { destinyManifestTableNames } from "~/bungie/constants";
import { prisma, type Prisma } from "./client";
@smashboy
smashboy / package.json
Created October 11, 2021 14:40
Railway deploy stuck
{
"name": "blitz-app",
"version": "1.1.0",
"scripts": {
"predev": "docker-compose up -d",
"dev": "concurrently --raw \"blitz dev\" 'quirrel'",
"build": "blitz build",
"postbuild": "next-sitemap --config next-custom-sitemap.js",
"start": "blitz start",
"studio": "blitz prisma studio",
@smashboy
smashboy / GenerateLocalesTypesPlugin.ts
Last active September 25, 2021 12:25
Dynamic locales import + webpack plugin for generating types from json
import path from "path";
import { getConfig } from "blitz";
import { readdir, stat, writeFile, readFile } from "fs/promises";
import {
quicktype,
InputData,
jsonInputForTargetLanguage,
TypeScriptTargetLanguage,
} from "quicktype-core";
import { DialogTitle } from "@material-ui/core";
import Dialog from "app/core/components/Dialog";
import RewardForm from "./RewardForm";
import { useTwitchSettings } from "app/collection-settings/hooks/useTwitchSettings";
import { useCustomMutation } from "app/core/hooks/useCustomMutation";
import createTwitchEventReward from "app/collection-settings/mutations/twitch/createTwitchEventReward";
import updateTwitchEventReward from "app/collection-settings/mutations/twitch/updateTwitchEventReward";
import { EventSelectorReward } from "app/collection-settings/queries/getTwitchSettings";
const EventRewardDialog: React.FC<{
import { NextApiRequest, NextApiResponse } from "next";
import multer from "multer";
import nextConnect from "next-connect";
import stream from "stream";
import { storage } from "../../firebase";
export type SaveEmbedImageReturnType = {
imageURL: string;
};
import React from "react";
import { Control, Controller, useWatch } from "react-hook-form";
import {
Grid,
Slider,
TextField,
Typography,
useMediaQuery,
useTheme,
} from "@material-ui/core";
export type UseQuardQueryPropsType<T extends QueryFn, TResult> = {
params: FirstParam<T>;
options?: QueryOptions<TResult>;
rules: useGuardInputType<
ResourceType<ExtendedResourceTypes>, // Your custom resources
AbilityType<ExtendedAbilityTypes> // Your custom abilities
>[];
rulesMatch?: "every" | "some";
};
import React from "react";
import { useRouter } from "next/router";
import {
Backdrop,
createStyles,
Theme,
makeStyles,
Box,
} from "@material-ui/core";
import {
import React from "react";
import { Button, Grid } from "@material-ui/core";
import useCollection from "../../hooks/useCollection";
import useNotifications from "../../hooks/useNotifications";
import useFetch from "../../hooks/useFetch";
import useAsync from "../../hooks/useAsync";
import {
PostDashboardWinResponseType,
PostWidgetRequestType,
} from "../../types/api";