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
| export enum DateFormats { | |
| 'MDY'=1, | |
| 'DMY', | |
| 'YMD' | |
| } | |
| export interface IDateFormat { | |
| date: string; | |
| format: DateFormats | |
| } |
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
| export default function guid() { | |
| function s4() { | |
| return Math.floor((1 + Math.random()) * 0x10000) | |
| .toString(16) | |
| .substring(1); | |
| } | |
| return `${s4()}${s4()}-${s4()}-${s4()}-${s4()}-${s4()}${s4()}${s4()}`; | |
| } | |
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
| // Auth an user and create it instantly in users collection | |
| firebase.auth().createUserWithEmailAndPassword(email, password) | |
| .then((userCredential) => { | |
| return firebase.firestore().collection('users').doc(userCredential.user.uid) | |
| .set({ | |
| field1: 'my-field-value', | |
| field2: 'my-field-value' | |
| ); | |
| }) | |
| .then(() => { |
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
| /** | |
| * libera leitura e escrita em todos os documentos | |
| */ | |
| rules_version = '2'; | |
| service cloud.firestore { | |
| match /databases/{database}/documents { | |
| match /{document=**} { | |
| allow read, write; | |
| } | |
| } |
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
| /** | |
| * libera a leitura e nega a escrita, apenas poderá ser feita a escrita diretamente no dashboard do firebase | |
| */ | |
| { | |
| "rules": { | |
| "infos": { | |
| ".read": "true", | |
| ".write": "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 from 'react'; | |
| import Box from './component-with-children'; | |
| class Component extends React.Component { | |
| render() { | |
| return <Box> | |
| <div>kid 1</div> | |
| <div>kid 2</div> | |
| <div>kid 3</div> | |
| </Box> |
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 validateDate(y, m, d) { | |
| var month = m-1; | |
| var _date = new Date(y, month, d); | |
| if(isNaN(_date)) return false; | |
| if (_date.getFullYear() != y | |
| || _date.getMonth() != month | |
| || _date.getDate() != d) { | |
| return 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
| const [state, setState] = useState({ name: "", surname: "" }); | |
| const handleChange = e => { | |
| const { name, value } = e.target; | |
| setState(prevState => ({ | |
| ...prevState, | |
| [name]: value | |
| })); | |
| }; | |
| <input |