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
0x44B882617388e462A9d58A06F07e913fA341b385 |
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
// getContext.js | |
import React, {Component} from 'react'; | |
const {Provider, Consumer} = React.createContext(); | |
const getContext = keys => WrappedComponent => props => ( | |
<Consumer> | |
{state => ( | |
<WrappedComponent |
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
1) Написать функцию, которая принимает на вход любое количество отрезков, заданных двумя координатами, и возвращает `true`, если любые 2 отрезка пересекаются, иначе возвращает `false`. Пример вызова: `f({x1: 1, x2: 10}, {x1: 11, x2: 123}, {x1: 122, x2: 124}, ...)` | |
2) Написать HOC, который будет менять `document.title` страницы при рендеринге компонента, который оборачиваем в HOC, и устанавливать старый `title` (который был до рендеринга) при unmount. Пример вызова: `@titlePage('Some new title')` | |
3) Написать функцию, принимающую на вход 2 числа `a` и `b`, и возвращающая `x = a/b`, при этом | |
a) в `x` после запятой может быть максимум 2 цифры | |
b) в `x` все нули после запятой должны быть убраны | |
Проверки (в том числе на то что `a` и `b` являются числами) делать не нужно. | |
Функция должна добавлять `$` в начало ответа. | |
Примеры вызова функции: |
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
'.source.js': | |
'sdiv': | |
'prefix': 'sdiv' | |
'body': """ | |
const $1 = styled.div` | |
$0 | |
`; | |
""" |
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, {Component} from 'react'; | |
import styled from 'styled-components'; | |
import {forbidExtraProps} from 'airbnb-prop-types'; | |
const Wr = styled.div` | |
`; | |
const Container = styled.div` | |
max-width: 1200px; | |
padding: 0 15px; |
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, {Component} from 'react'; | |
import styled, {css} from 'styled-components'; | |
import {forbidExtraProps, explicitNull, or} from 'airbnb-prop-types'; | |
import getContext from 'getContext'; | |
import {onlyUpdateForKeys} from 'recompose'; | |
import {string, object, number, func, array} from 'prop-types'; | |
import {Link, ButtonContainer, BounceSpinner, ReconnectOverlay} from 'App/dumb'; | |
import SelectAssetModal from './SelectAssetModal'; | |
import {t, formatToTwoNonZeroDecimals, webConnector, convertToEth} from 'App/utils'; | |
import trustedAssetsRaw from './trustedAssetsRaw'; |
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, {memo, useContext} from 'react'; | |
const Context = React.createContext(); | |
export function withContext(Component, keys) { | |
Component = memo(Component); | |
return memo(function(props) { | |
let state = useContext(Context); | |
if (process.env.NODE_ENV !== 'production') { | |
keys.forEach(key => { | |
if (props.hasOwnProperty(key) && state.hasOwnProperty(key)) { |
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, | |
} from 'react'; | |
import styled, {css} from 'styled-components'; | |
import {forbidExtraProps} from 'airbnb-prop-types'; | |
import {ButtonContainer, SelectAssetModal} from 'App/dumb'; | |
import {func, string, object} from 'prop-types'; | |
import {withContext} from 'withContext'; | |
import Values from './Values'; | |
import payFeeAssetsRaw from './payFeeAssetsRaw'; |
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 MAX_WIDTH = 1200; | |
const MIN_WIDTH = 320; | |
export default function getSize(windowInnerWidth, ...values) { | |
if (values.some(({x1: x11, x2: x12}, idx1) => { | |
return values.some(({x1: x21, x2: x22}, idx2) => { | |
if (idx1 === idx2) { | |
return false; | |
} | |
const max1 = Math.max(x11, x12); |
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
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box. | |
✅ did:muport:QmcVVXoRrkYnYtMAwPLgGWSQgWqFVYkGcxsJco3yfBj56u ✅ | |
Create your profile today to start building social connection and trust online at https://3Box.io/ |
OlderNewer