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, { createElement } from 'react'; | |
import { render } from 'react-dom'; | |
import { Provider, connect } from 'react-redux'; | |
import { store } from 'store'; | |
const TypeConnector = connect(({ router: { type } }) => { | |
return { | |
type | |
}; |
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
<Ratio width={Ratio.OPTIONS.FLUID} x={3} y={4}> | |
{(width, height) => ( | |
<Chart id={this.props.id} width={width} height={height} /> | |
)} | |
</Ratio> |
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 { validate, list, dict, required, optional } from 'validators'; | |
pipe( | |
validate( | |
identity, | |
[ | |
required('first', isString), | |
optional('second', list(isString), []), | |
// required(['third', 'subParam', 'deepParam'], isNumber) |
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 { validator } from 'validator' | |
import { VALIDATOR_SYMBOL } from 'validator-middleware'; | |
const data = { x: 1, y: 2 }; | |
const validator = validator(fn1, fn2); // curry, one data input left | |
const action = { | |
[VALIDATOR_SYMBOL]: { | |
data, |
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 from 'react'; | |
import { connect } from 'react-redux'; | |
class FetchComponent extends React.Component { | |
constructor() { | |
super(); | |
this.state = { | |
dataFetched: false | |
}; | |
} |
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 { connect } from 'react-redux'; | |
import { formsReducer, FormsActions, convertFormData, haveFormDataError } from 'forms'; | |
const FORMS_REDUCER_ID = 'forms'; | |
const store = createStore(formsReducer); | |
const dispach = store.dispach; |
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
var article = { | |
title: 'Hello Template Literals', | |
teaser: 'String interpolation is awesome. Here are some features', | |
body: 'Lots and lots of sanitized HTML', | |
tags: ['es6', 'template-literals', 'es6-in-depth'] | |
} | |
function html(template, ...expressions) { | |
return template.reduce((accumulator, part, i) => { | |
return accumulator + expressions[i - 1] + part |
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
#!/usr/bin/env bash | |
# MIT © Sindre Sorhus - sindresorhus.com | |
# git hook to run a command after `git pull` if a specified file was changed | |
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" |
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
https://gist.github.com/joshdover/7c5e61ed68cc5552dc8a25463e357960 | |
https://github.com/jpuri/react-draft-wysiwyg/blob/master/js/src/components/Controls/TextAlign/index.js |
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
function CustomEditor() { | |
... | |
return ( | |
<Editor | |
editorState={editorState} | |
onChange={onChange} | |
blockStyleFn={myBlockStyleFn} | |
handleReturn={createHandleReturn(editorState, onChange)} |