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
{ | |
"Redux-toolkit slice": { | |
"prefix": "reduxSlice", | |
"body": [ | |
"import { createSlice } from '@reduxjs/toolkit'", | |
"", | |
"export type InitialState = {}", | |
"", | |
"const initialState: InitialState = {}", | |
"", |
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
html, body { | |
background-color: #f2cd37; | |
} | |
.container { | |
width: 1000px; | |
margin: 0 auto; | |
} | |
.logo { |
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 { useEffect } from "react" | |
export function useDetectAppleDevice() { | |
const isMac = /(Mac|iPhone|iPod|iPad)/i.test(navigator.userAgent) | |
useEffect(() => { | |
if (isMac) { | |
document.documentElement.classList.add("apple-device") | |
} | |
}, [isMac]) |
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 { useEffect, useRef } from 'react' | |
function usePrevious<T>(value: T): T { | |
const ref = useRef(value) | |
useEffect(() => { | |
ref.current = value | |
}, [value]) | |
return ref.current |
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
jest | |
.useFakeTimers({ now: currentDate, advanceTimers: true }) | |
.setSystemTime(currentDate) |
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 { Children, FunctionComponent, ReactNode } from "react"; | |
export interface Props { | |
children: ReactNode; | |
reverse: boolean; | |
} | |
const ChildrenReversable: FunctionComponent<Props> = ({ children, reverse }) => { | |
const componentChildren = !reverse | |
? children |
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 { ApolloServer } from '@apollo/server' | |
import { startStandaloneServer } from '@apollo/server/standalone' | |
// The GraphQL schema | |
const typeDefs = `#graphql | |
type Query { | |
hello: String | |
} | |
` |
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
jest.mock('fs') | |
import fs from 'fs' | |
const mockedFs = fs as jest.Mocked<typeof fs> | |
describe('fetch', () => { | |
describe('file exists', () => { | |
beforeEach(() => { | |
mockedFs.existsSync.mockImplementation(() => true) |
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
name: Merged | |
on: | |
pull_request: | |
branches: [main] | |
types: | |
- closed | |
jobs: | |
is_merged: |
NewerOlder