This file contains hidden or 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 function diffArrayByKey<T, K1 extends keyof T, K2 extends T[K1]>( | |
one: T[], | |
key: K1, | |
two: K2[] | |
) { | |
if (!Array.isArray(two)) { | |
return one.slice(); | |
} | |
const tlen = two.length; |
This file contains hidden or 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
#!/usr/bin/env zx | |
/** @type {import('zx/globals')} */ |
This file contains hidden or 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
/* | |
* Stripe WebGl Gradient Animation | |
* All Credits to Stripe.com | |
* ScrollObserver functionality to disable animation when not scrolled into view has been disabled and | |
* commented out for now. | |
* https://kevinhufnagl.com | |
*/ | |
This gist demonstrate how to enable syntax highlight on vscode for nx template files.
The Nx template files uses EJS syntax
To enable the syntax hightlight for EJS just install this extension and add the config below to your vscode settings.json file
Addtionally you can add *__tmpl__
your .prettierignore
file
This file contains hidden or 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
declare module 'remoteA/componentA' { | |
function Component(props: unknown): JSX.Element; | |
export default Component; | |
} | |
declare module 'remoteB/componentB' { | |
export type ComponentProps = { | |
foo: boolean; | |
bar?: () => void; | |
}; |
This file contains hidden or 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 { ComponentProps, JSXElementConstructor } from 'react'; | |
export const provider = <C extends JSXElementConstructor<unknown>>( | |
provider: C, | |
props: Partial<ComponentProps<C>> = {} | |
) => [provider, props]; | |
export const ProviderComposer = ({ providers, children }) => { | |
for (let i = providers.length - 1; i >= 0; --i) { | |
const [Provider, props] = providers[i]; |
This file contains hidden or 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 App, { AppProps, AppContext } from 'next/app'; | |
function MyApp({ Component, pageProps }: AppProps) { | |
return ( | |
<Component {...pageProps} /> | |
); | |
} | |
MyApp.getInitialProps = async (context: AppContext) => { | |
return await App.getInitialProps(context); // Retrieves page's `getInitialProps` |
This file contains hidden or 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
__REACT_DEVTOOLS_GLOBAL_HOOK__.renderers.forEach(r => console.log(`${r.rendererPackageName}: ${r.version}`)) |
This file contains hidden or 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
/* | |
{ | |
"compilerOptions": { | |
"baseUrl": ".", | |
"outDir": "build/dist", | |
"module": "esnext", | |
"target": "es6", | |
"lib": [ | |
"es2019", | |
"dom", |