This emulate's vim's <C-e> and <C-y>
for scrolling in VSCode using the macros extension.
- add the following to
settings.json
"macros": {
"scrollLineDownFaster": [
"scrollLineDown",
import React from 'react' | |
import styled from '@emotion/styled' | |
type StatusType = 'error' | 'neutral' | 'success' | |
type State = { | |
isStatusShowing: boolean | |
status: string | |
type: StatusType | |
} |
import React from 'react' | |
import firebaseConfig from '../path/to/firebase-config' | |
import firebase from 'firebase/app' | |
import 'firebase/auth' | |
import FullPageLoading from '../path/to/full-page-loading' | |
AuthProvider.actions = { | |
setUser: 'SET_USER', | |
toggleLoading: 'TOGGLE_LOADING', | |
} |
yad @typescript-eslint/parser eslint-config-react-app eslint-plugin-jsx-a11y eslint-config-prettier eslint-plugin-react-hooks |
import React from 'react' | |
type DropzoneContextValue = { | |
isDragging: boolean | |
} | |
const DropzoneContext = React.createContext<DropzoneContextValue | undefined>( | |
undefined | |
) |
import React from "react"; | |
function isMobile() { | |
if (typeof document !== `undefined`) { | |
return "ontouchstart" in document.documentElement === true; | |
} | |
return false; | |
} | |
const mobile = isMobile(); |
import React from "react" | |
export default function useFocus() { | |
const cachedElement = React.useRef(null) | |
const setFocusCache = () => (cachedElement.current = document.activeElement) | |
const setFocus = () => | |
cachedElement.current ? cachedElement.current.focus() : {} |
import React from 'react' | |
const FocusContext = React.createContext() | |
export function FocusProvider({ children }) { | |
const focusElement = React.useRef(null) | |
const cacheFocusElement = element => (focusElement.current = element) | |
const toggleFocus = () => { |
const capturePosition = () => { | |
const cachedPosition = window.pageYOffset | |
return { | |
freeze: () => { | |
document.body.style = | |
`position: fixed; | |
top: ${cachedPosition * -1}px; | |
width: 100%;` | |
}, | |
unfreeze: () => { |
import React from 'react' | |
export function WithConfirmation({ children }) { | |
const [hasConfirmed, setConfirm] = React.useState(false) | |
return children({ | |
hasConfirmed, | |
setConfirm, | |
}) | |
} |