

#!/bin/bash | |
while true | |
do | |
echo "Running" | |
ore --rpc "$1" --keypair "$2" --priority-fee 1000 mine --threads 4 | |
echo "Exited" | |
done |
import { Snackbar } from '@material-ui/core'; | |
import { Alert, Color } from '@material-ui/lab'; | |
import React, { createContext, useContext } from 'react'; | |
type SnackBarContextActions = { | |
showSnackBar: (text: string, typeColor: Color) => void; | |
}; | |
const SnackBarContext = createContext({} as SnackBarContextActions); |
const AccountCollection = mongoDb.collection('Accounts') | |
await AccountCollection.createIndex({ userId: 1 }); | |
const accountStore = { | |
createAccount: async({name, userId, balance=0, id= Id.makeId(), createdAt=Date.now(), updatedAt=Date.now(), isDefault=true}) => | |
{ | |
if (!userId) throw new Error('createAccount userId missing') |
// npm i axios | |
const axios = require('axios').default; | |
axios.interceptors.request.use( x => { | |
// to avoid overwriting if another interceptor | |
// already defined the same object (meta) | |
x.meta = x.meta || {} | |
x.meta.requestStartedAt = new Date().getTime(); | |
return x; |
import { LinkProps, Link as MuiLink } from '@mui/material' | |
import NextLink from 'next/link' | |
export default function Link(props: LinkProps<'a'>) { | |
return <MuiLink component={NextLink} {...props} /> | |
} |
This is a quick-and-dirty walkthrough to set up a fresh project with Storybook Docs, Create React App, and TypeScript. If you're looking for a tutorial, please see Design Systems for Developers, which goes into much more depth but does not use Typescript.
The purpose of this walkthrough is a streamlined Typescript / Docs setup that works out of the box, since there are countless permutations and variables which can influence docs features, such as source code display, docgen, and props tables.
npx create-react-app cra-ts --template typescript
export const mockWaiting = (): AsyncInitial<any> => ({ | |
data: undefined, | |
error: undefined, | |
initialValue: undefined, | |
startedAt: undefined, | |
finishedAt: undefined, | |
status: "initial", | |
isInitial: true, | |
isPending: false, | |
isLoading: false, |
import * as React from 'react' | |
const { useState, useEffect, useRef } = React | |
type IntervalFunction = () => ( unknown | void ) | |
function useInterval( callback: IntervalFunction, delay: number ) { | |
const savedCallback = useRef<IntervalFunction| null>( null ) |