Skip to content

Instantly share code, notes, and snippets.

<LineChart
width={500}
height={300}
data={data}
margin={{
top: 5, right: 30, left: 20, bottom: 5,
}}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="name" />
@gaurav5430
gaurav5430 / nivo-linechart-syntax
Created June 13, 2020 17:31
linechart example from Nivo
<ResponsiveLine
data={data}
margin={{ top: 50, right: 110, bottom: 50, left: 60 }}
xScale={{ type: 'point' }}
yScale={{ type: 'linear', min: 'auto', max: 'auto', stacked: true, reverse: false }}
axisTop={null}
axisRight={null}
axisBottom={{
orient: 'bottom',
tickSize: 5,
Select.propTypes = {
children: (props, propName, componentName) => {
let error;
const prop = props[propName];
React.Children.forEach(prop, (child) => {
// type.name seems to work for both Class and Functional components
if (child.type.name !== 'Option') {
error = new Error(`\`${componentName}\` only accepts children of type \`Option\`.`,);
}
});
import tensorflow as tf
import tensorflow_hub as hub
import numpy as np
import os, sys
from sklearn.metrics.pairwise import cosine_similarity
# get cosine similairty matrix
def cos_sim(input_vectors):
similarity = cosine_similarity(input_vectors)
return similarity
import nltk
from nltk.stem import WordNetLemmatizer
from nltk.corpus import wordnet
lemmatizer = WordNetLemmatizer()
# function to convert nltk tag to wordnet tag
def nltk_tag_to_wordnet_tag(nltk_tag):
if nltk_tag.startswith('J'):
return wordnet.ADJ
export const asyncApiCall = (values) => {
return async dispatch => {
try {
const response = await axios.get(url);
dispatch(successHandle(response));
}
catch(error) {
dispatch(errorHandle(error));
}
export const asyncApiCall = (values) => {
return dispatch => {
return axios.get(url)
.then(response =>{
dispatch(successHandle(response));
})
.catch(error => {
dispatch(errorHandle(error));
});
}