This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while true | |
do | |
echo "Running" | |
ore --rpc "$1" --keypair "$2" --priority-fee 1000 mine --threads 4 | |
echo "Exited" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const mockWaiting = (): AsyncInitial<any> => ({ | |
data: undefined, | |
error: undefined, | |
initialValue: undefined, | |
startedAt: undefined, | |
finishedAt: undefined, | |
status: "initial", | |
isInitial: true, | |
isPending: false, | |
isLoading: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ) |
NewerOlder