const x is a function that returns x for all inputs.
const :: a -> b -> a
const x _ = x
const 1 2 = 1
const 1 3 = 1| # Unbind from non-macOS setup | |
| unbind-key -T copy-mode-vi 'y' | |
| # Copy now goes to macOS clipboard | |
| bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" |
| import * as R from 'ramda'; | |
| const multiplySides = R.reduce(R.multiply, 1); | |
| const divideByTwo = R.divide(2); | |
| const averageTriangle = R.pipe( | |
| R.map(multiplySides), | |
| R.map(divideByTwo), | |
| R.mean | |
| ); |
| import React from ‘react’; | |
| import {userType, fullName} from ‘./user’; | |
| const UserComponent = user => ( | |
| <div>Name: {fullName(user)}</div> | |
| ); | |
| UserComponent.propTypes = { | |
| user: userType | |
| }; |
| { | |
| "jest-component": { | |
| "prefix": "jestcomponent", | |
| "body": [ | |
| "import React from 'react';", | |
| "import { shallow } from 'enzyme';", | |
| "import $1 from '../$1';", | |
| "", | |
| "describe('$1', () => {", | |
| " let props;", |
| import React from "react"; | |
| const BigGrid = ({ number }) => { | |
| ... | |
| }; | |
| export default React.memo(BigGrid); |
| import React, { useState } from "react" | |
| const CountDown = () => { | |
| const [count, setCount] = useState(0) | |
| const remaining = 10 - count | |
| const increment = () => { | |
| if (remaining > 0) { | |
| setCount(count + 1) |
| /* eslint-disable react-hooks/exhaustive-deps */ | |
| import React from "react"; | |
| export const useCombineLatest = <T extends any[], U>( | |
| values: T, | |
| f: (...values: T) => U | |
| ): U => { | |
| return React.useMemo(() => f(...values), [f, ...values]); | |
| }; |
| export const App: FunctionComponent = () => { | |
| const [videoRef, status] = useWebcam(); | |
| { | |
| /* Hooks... */ | |
| } | |
| return ( | |
| <PredictionWrapper status="none"> | |
| {/* ... */} |