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
function (limit) { | |
const RateLimiter = require('limiter').RateLimiter; | |
const isUserAnonymous = require('./helper/is-anonymous'); | |
const limiter = new RateLimiter(limit, 'second', true); | |
return (req, res, next) => { | |
const isAnonymous = isUserAnonymous(req); | |
if (isAnonymous) { | |
next(); | |
} |
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
function (duration) { | |
// cutted code | |
return (req, res, next) => { | |
// cutted code | |
if (res.locals.ratelimited) { | |
if (cacheContent) { | |
res.setHeader(cacheKeyHeader, 'HIT'); | |
res.status(200).send(cacheContent); | |
return; | |
} else { |
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 jsonString = jsesc(JSON.stringify(data), { | |
json: true, | |
isScriptContext: true | |
}); | |
<script>window.__INITIAL_STATE__ = JSON.parse(${jsonString})</script> |
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
/* eslint-disable */ | |
declare namespace PetstoreRaw { | |
namespace RequestBodies { | |
export type Pet = Schemas.Pet; | |
export type UserArray = Schemas.User[]; | |
} | |
namespace Schemas { | |
export interface Address { | |
/** | |
* example: |
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 'reflect-metadata'; | |
import { | |
createModule, | |
testkit, | |
gql, | |
} from 'graphql-modules'; | |
export const _hackKeepExtendWorking = { | |
typeDefs: gql` | |
type Query { |
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
``` | |
// thanks to Olga | |
const merge = require('deepmerge'); | |
type DeepPartial<T> = T extends object | |
? { [K in keyof T]?: DeepPartial<T[K]> } | |
: T; | |
export type TBuilder<O> = (attrs?: DeepPartial<O>) => O; | |
const overwriteMerge = <T extends any>( | |
destinationArray: T[], | |
sourceArray: T[], |
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
/** | |
* Box is the most abstract component on top of which other chakra | |
* components are built. It renders a `div` element by default. | |
* | |
* @see Docs https://chakra-ui.com/box | |
*/ | |
export declare const Box: import("@chakra-ui/system").ChakraComponent<"div", {}>; |
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 StyledRow = styled(Box)` | |
box-sizing: content-box; | |
`; | |
const padding = { base: 4, md: 8 }; | |
export function Row({ | |
...boxProps | |
}: Omit<BoxProps, 'p' | 'pl' | 'pr' | 'm' | 'ml' | 'mr'>) { | |
return ( |
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 { addDecorator } from '@storybook/react'; | |
import { themeDefault } from '../themes/default'; | |
import { themeFoo } from '../themes/foo'; | |
import { themeBar } from '../themes/bar'; | |
export const globalTypes = { | |
theme: { | |
name: 'Theme', | |
description: 'Theme selector', | |
toolbar: { |
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
type ComponentProps = { | |
isDifficult?: boolean; | |
} & BoxProps; | |
export function Component({ | |
isDifficult, | |
...boxProps | |
}: ComponentProps) { | |
return ( | |
<Box |