This file contains hidden or 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
'use strict'; | |
/* | |
Before creating your service, | |
add your API key to serverless.yml file | |
For example, a valid conf: | |
service: | |
name: revue | |
provider: |
This file contains hidden or 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
// line 41: public & private are your Uploadcare API keys | |
/* | |
Call is nodeJS script (pass) : | |
async function main() { | |
const res = await pushBatchUrlsToUploadCare(['123']); | |
console.log(res); // { err: { '123': 'Invalid' } } | |
} |
This file contains hidden or 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
// If you're using https://github.com/lokiuz/redraft, | |
// reuse these methods in your renderers module. | |
const urlRegex = (/((?:https?(?::\/\/))(?:www\.)?(?:[a-zA-Z\d-_.]+(?:\.[a-zA-Z\d]{2,})|localhost)(?:(?:[-a-zA-Z\d:%_+.~#!?&//=@]*)(?:[,](?![\s]))*)*)/g); | |
function findWithRegex(regex, contentBlock, callback) { | |
const text = contentBlock.getText(); | |
let matchArr; | |
let start; | |
matchArr = regex.exec(text); |
This file contains hidden or 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 PropTypes from 'prop-types'; | |
import Measure from 'react-measure'; | |
import classnames from 'classnames'; | |
// replace this if you don't use CSS modules | |
import cls from './affix.module.scss'; | |
class Affix extends Component { |
This file contains hidden or 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
// See it in action here https://codesandbox.io/s/mkznro61j | |
import React, { Component } from 'react'; | |
import { render } from 'react-dom'; | |
import PropTypes from 'prop-types'; | |
import { | |
BrowserRouter, | |
Link, |
This file contains hidden or 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 { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
/* | |
Example: | |
<KeyListener | |
actions={[ | |
{ | |
keyCode: 27, | |
method: (e) => { |
This file contains hidden or 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 { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
class ForwardRef extends Component { | |
static propTypes = { | |
children: PropTypes.func.isRequired, | |
ComponentWrapper: PropTypes.string || PropTypes.node, | |
refPropName: PropTypes.string, | |
} | |
static defaultProps = { |
This file contains hidden or 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
// See it in action here: https://codesandbox.io/s/ovyk4qx8yy | |
import React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
class ForwardScroll extends Component { | |
static propTypes = { | |
children: PropTypes.func.isRequired, | |
ComponentWrapper: PropTypes.node || PropTypes.string, | |
} |
This file contains hidden or 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 { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
class ForwardState extends Component { | |
static propTypes = { | |
children: PropTypes.func.isRequired, | |
ComponentWrapper: PropTypes.string || PropTypes.node, | |
init: PropTypes.object, // eslint-disable-line react/forbid-prop-types | |
setStatePropName: PropTypes.string, | |
statePropName: PropTypes.string, |
This file contains hidden or 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 { Component } from 'react'; | |
import { func } from 'prop-types'; | |
// See related Gist | |
import MousePosListener from '../MousePosListener'; | |
const distancePoints = (x1, y1, x2, y2) => | |
Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); | |
class ForwardProximity extends Component { |
OlderNewer