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 from 'react' | |
import {render} from 'react-dom' | |
import {Chart} from 'react-google-charts' | |
export default class App extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
data: [], |
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 log = (...args) => { | |
console.log(" ".repeat(new Error().stack.match(/\n/g).length - 2), ...args); | |
}; |
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
Array.from(new Set(Array.from(document.querySelectorAll('[data-testid]')).map(el => el["dataset"]["testid"]))) |
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 from 'react' | |
import {render} from 'react-dom' | |
import {Chart} from 'react-google-charts' | |
class App extends React.Component{ | |
constructor(props) { | |
super(props); | |
} | |
onSelectEvent(Chart) { | |
console.log(Chart.chart.getSelection()); |
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
yarn add -D jest babel-jest babel-preset-es2015 babel-preset-react react-test-renderer | |
#Edit package.json adding the jest command : | |
"scripts": { | |
"build": "nwb build-react-component", | |
"clean": "nwb clean-module && npm clean-demo", | |
"start": "nwb serve-react-demo", | |
"test": "nwb test", | |
"test:coverage": "nwb test --coverage", | |
"test:watch": "nwb test --server", | |
"test:jest": "jest" |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Page Title</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> |
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
( export PKG=eslint-config-airbnb; npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs yarn add -D "$PKG@latest"; ) | |
yarn add babel-eslint | |
echo "{ | |
\"parser\": \"babel-eslint\", | |
\"env\": { | |
\"browser\": true, | |
\"node\": true, | |
\"jest\": true, | |
}, | |
\"extends\": \"airbnb\", |
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 { reaction, observable, runInAction } from 'mobx'; | |
const myObservableMap = observable.map({}); | |
const disposeReaction = reaction(() => myObservableMap, (newObservableValue) => { | |
console.warn('Someone changed the observable map. new value : ', newObservableValue); | |
}) | |
myObservableMap.set('some', {data: 'of any type'}) | |
myObservableMap.set('someOther', 'data') |
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 photoshoot = (...args) => { | |
args.forEach(arg => | |
expect(arg).toMatchSnapshot() | |
); | |
}; |
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
# Your snippets | |
# | |
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to | |
# expand the prefix into a larger code block with templated values. | |
# | |
# You can create a new snippet in this file by typing "snip" and then hitting | |
# tab. | |
# | |
# An example CoffeeScript snippet to expand log to console.log: | |
# |
NewerOlder