Skip to content

Instantly share code, notes, and snippets.

View estevam5s's full-sized avatar
🐳
What's happening

Estevam estevam5s

🐳
What's happening
View GitHub Profile
@estevam5s
estevam5s / .eslintrc
Created July 12, 2022 16:14
.eslintrc
{
"parser": "babel-eslint",
"env": {
"browser": true,
"jest": true
},
"plugins": [
"react-native",
"jsx-a11y",
"import"
@estevam5s
estevam5s / async-await.js
Created July 12, 2022 16:14
async-await.js
async function fetchUserAndGroups() {
const user = await api.get('/users/diego3g');
const groups = await api.get(`/groups/${user.id}`);
groups.map(group => {
const groupInfo = await api.get(`/group/${group.id}`);
console.log(groupInfo);
});
}
@estevam5s
estevam5s / promise-all.js
Last active May 29, 2023 16:09
promises.js
Promise.all([
api.get('/users/diego3g'),
api.get('/phones/diego3g'),
]).then([user, phones] => {
console.log(user);
console.log(phones);
});
@estevam5s
estevam5s / callback.js
Created July 12, 2022 16:16
callback.js
function asyncFunction(params, callback, err) {
var response = // requisição assíncrona
if (response.status === true) {
callback(response.data);
} else {
err(response.data);
}
}
asyncFunction(
@estevam5s
estevam5s / form.js
Created July 12, 2022 16:18
form.js
import React from 'react';
import { View, TextInput, Button } from 'react-native';
import { withFormik } from 'formik';
const Form = (props) => (
<View style={styles.container}>
<TextInput
value={props.values.email}
onChangeText={text => props.setFieldValue('email', text)}
@estevam5s
estevam5s / auth.js
Created July 12, 2022 16:18
auth.js
// store/ducks/auth.js
// Action Types
export const Types = {
LOGIN: 'auth/LOGIN',
LOGOUT: 'auth/LOGOUT',
};
// Reducer
@estevam5s
estevam5s / login.js
Created July 12, 2022 17:26
login.js
// src/pages/login.js
import React from "react";
import { View } from "react-native";
import { Card, Button, FormLabel, FormInput } from "react-native-elements";
import { onSignIn } from "../services/auth";
export default ({ navigation }) => (
<View style={{ paddingVertical: 20 }}>
<Card>
@estevam5s
estevam5s / .gitignore
Created July 12, 2022 17:57
.gitignore
# -----------------------------------------------------------------
# .gitignore
# Bare Minimum Git
# https://salferrarello.com/starter-gitignore-file/
# ver 20220128
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/10017553/raw/.gitignore
# to download this file
#
@estevam5s
estevam5s / .eslintrc.js
Created July 12, 2022 18:03
.eslintrc.js
const { resolve } = require('path');
module.exports = {
env: {
browser: true,
es6: true,
jest: true,
},
globals: {
Atomics: 'readonly',
@estevam5s
estevam5s / .gitconfig
Last active May 29, 2023 15:08
.gitconfig
[alias]
ci = commit
co = checkout
cm = checkout master
cb = checkout -b
st = status -sb
sf = show --name-only
lg = log --pretty=format:'%Cred%h%Creset %C(bold)%cr%Creset %Cgreen<%an>%Creset %s' --max-count=30
incoming = !(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' ..@{u})
outgoing = !(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' @{u}..)