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
const fs = require('fs'); | |
const path = require('path'); | |
const Sequelize = require('sequelize'); | |
const basename = path.basename(__filename); | |
const { DB } = require('../../config/config'); | |
const config = DB; | |
const db = {}; | |
const sequelize = new Sequelize( | |
config.database, |
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, { useState, useEffect } from 'react'; | |
import axios from 'axios'; | |
// https://www.robinwieruch.de/react-hooks-fetch-data | |
const useDataApi = () => { | |
const [items, setData] = useState(); | |
const [url, setUrl] = useState(); | |
const [isLoading, setIsLoading] = useState(false); | |
const [isError, setIsError] = useState(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 React, { useState } from 'react'; | |
import { | |
Button, | |
DialogContainer, | |
TextField, | |
Toolbar, | |
SelectField, | |
} from 'react-md'; | |
import axios from 'axios'; |
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
// instalar => npm install --save keycode | |
const getFoodUuid = (data, item) => data.find(i => i.label === item).uuid | |
// AUTOCOMPLETE | |
handleInputChange = event => { | |
this.setState({ inputValue: event.target.value }) | |
} | |
// AUTOCOMPLETE |
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 PropTypes from 'prop-types' | |
import deburr from 'lodash/deburr' | |
import Downshift from 'downshift' | |
import { withStyles } from '@material-ui/core/styles' | |
import { TextField, Paper, MenuItem, Chip } from '@material-ui/core' | |
function renderInput(inputProps) { | |
const { InputProps, classes, ref, ...other } = inputProps | |
return ( |
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
module.exports = { | |
"env": { | |
"browser": true, | |
"commonjs": true, | |
"es6": true | |
}, | |
"extends": "eslint:recommended", | |
"parserOptions": { | |
"ecmaFeatures": { | |
"jsx": true |
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
const Hashids = require('hashids'); | |
const hashids = new Hashids() | |
const dateTime = Date.now('1985-14-05') | |
const timestamp = Math.floor(dateTime / 1000) | |
console.log('DateTime ===>', dateTime) | |
console.log('Timestamp ===>', timestamp) | |
const encrypted = hashids.encodeHex(timestamp) |
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, { createContext } from 'react' | |
export const TableContext = createContext() | |
export const Row = ({ row }) => ( | |
<TableContext.Consumer> | |
{({ columns }) => ( | |
columns.map((field, i) => <td key={i}>{row[field.name]}</td>) | |
)} | |
</TableContext.Consumer> |
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
body { | |
margin: 0; | |
padding: 0; | |
font-size: 16px; | |
font-family: sans-serif; | |
} | |
table { | |
margin: 2em auto; | |
width: 80%; |
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 {Table, Header, Body, TableContext} from './table.component' | |
import './App.css'; | |
class App extends Component { | |
state = { | |
activeRow: null, | |
data: [ | |
{ Id: "1", Year: "1961", Make: "Jaguar", Model: "E-Type" }, | |
{ Id: "2", Year: "1969", Make: "Ferrari", Model: "365 GT 2 + 2" }, |