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 { maxBy, minBy } from 'lodash' | |
// see https://gist.github.com/afraser/40a3a6e6f51343681a63d051d211d2f3 | |
import rangeTransform from '@/utils/range-transform' | |
type Point = { | |
x: number | |
y: number | |
} |
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
/** | |
Scales a number expected to be in the range [inMin-inMax] | |
to a number in the range [outMin-outMax] | |
eg: | |
rangeTransform(5, [0, 10], [0, 50]) | |
> 25 | |
NOTE: If num is outside of [inMin-inMax] the result will | |
also be outside [outMin-outMax]. |
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 Auth from '@aws-amplify/auth' | |
/** | |
USAGE: | |
> api.post(`users/${id}`, { email: 'asdf@asdf.com' }) | |
> api.get('users/${id}') | |
> api.patch(`users/${id}`, { email: 'adam@asdf.com' }) | |
> api.delete(`users/${id}`) | |
*/ | |
class ApiClient { |
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 axios, { CancelTokenSource } from 'axios' | |
import TokenService from './token.service' | |
export const api = axios.create({ | |
baseURL: process.env.REACT_APP_API_BASE_URL || '', | |
withCredentials: true, | |
}) | |
const requestCancelSourcesByKey: { [cancelKey: string]: CancelTokenSource } = {} |
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, useMemo, useState } from 'react' | |
import { | |
get, set, every, isPlainObject, cloneDeep, cloneDeepWith, isEqual | |
} from 'lodash' | |
import { resolver } from 'js/util/validators' | |
const parseIntOrNull = (val) => { | |
const intVal = parseInt(val) | |
return isNaN(intVal) ? null : intVal | |
} |
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 Auth from '@aws-amplify/auth' | |
/** | |
USAGE: | |
> api.post(`users/${id}`, { email: 'asdf@asdf.com' }) | |
> api.get('users/${id}') | |
> api.patch(`users/${id}`, { email: 'adam@asdf.com' }) | |
> api.delete(`users/${id}`) | |
*/ | |
class ApiClient { |
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, useRef } from 'react' | |
import cx from 'classnames' | |
import css from './FileDropzone.sass' | |
export function FileDropzone ({ onDrop, children }) { | |
const [dragging, setDragging] = useState(0) | |
const dropRef = useRef() | |
const handleDrag = evt => { |
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
<!-- | |
Copyright (c) 2013-present, Facebook, Inc. All rights reserved. | |
This file provided by Facebook is for non-commercial testing and evaluation | |
purposes only. Facebook reserves all rights not expressly granted. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
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, PropTypes } from 'react' | |
import Toolbar from 'containers/Toolbar' | |
import InlineMath, { forceUpdateEquation } from 'containers/InlineMath' | |
import EquationEditor from 'components/EquationEditor' | |
import { Editor, EditorState, ContentState, SelectionState, Entity, CompositeDecorator, Modifier, convertToRaw, RichUtils } from 'draft-js' | |
const SUPPORTED_COMMANDS = [ 'italic' ] | |
function findTex(contentBlock, callback) { | |
contentBlock.findEntityRanges( |
NewerOlder