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
# JAVASCRIPT | |
'.source.js, .source.ts, .source.tsx': | |
'Require': | |
'prefix': 'req' | |
'body': 'const ${1:module} = require(\'${1:module}\');' | |
'Module Exports': | |
'prefix': 'export' | |
'body': 'module.exports = $1;' | |
'Import': | |
'prefix': 'import' |
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 React, { useState, useEffect } from 'react'; | |
import { render, act, cleanup } from '@testing-library/react'; | |
import { EXITED, EXITING, ENTERED, ENTERING } from '../constants'; | |
import { useAnimator } from '../useAnimator'; | |
import { Component as Animator } from './Animator.component'; | |
jest.useFakeTimers(); | |
afterEach(cleanup); |
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 React, { useEffect, useState } from 'react'; | |
import { render } from 'react-dom'; | |
const ProductionProfiler = ({ children }) => { | |
const [mount, setMount] = useState(false); | |
useEffect(() => { | |
if (!mount) { | |
console.time('profile'); | |
setMount(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
import { isBrowser } from './browser'; | |
type RAFSchedulerId = number | string; | |
type RAFSchedulerCallback = () => unknown; | |
// TODO: How to handle suspended schedules on suspended window? | |
const raf = (delay: number, callback: RAFSchedulerCallback): () => void => { | |
let scheduleId: number | undefined; |
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 { isBrowser } from './browser'; | |
type TOSchedulerId = number | string; | |
type TOSchedulerCallback = () => unknown; | |
const timeoutTask = (delay: number, callback: TOSchedulerCallback): () => void => { | |
const scheduleId = setTimeout(() => callback(), delay); | |
return () => clearTimeout(scheduleId); | |
}; |
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
/** @jsxImportSource @emotion/react */ | |
import { jsx } from '@emotion/react'; | |
import { ReactElement, useState, useEffect } from 'react'; | |
import { Animator, AnimatorGeneralProvider } from '@arwes/animator'; | |
import { Animated } from '@arwes/animated'; | |
const AnimatedItem = (props: { color: string }): ReactElement => { | |
return ( | |
<Animated |
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 checkGameIndex (checkedIndexesCache, list, index) { | |
const offset = list[index]; | |
const is0 = list[index] === 0; | |
const is0ToLeft = list[index - offset] === 0; | |
const is0ToRight = list[index + offset] === 0; | |
if (is0 || is0ToLeft || is0ToRight) { | |
return true; | |
} |
OlderNewer