Skip to content

Instantly share code, notes, and snippets.

View maiquealmeida's full-sized avatar
🚜
Agribusiness Oriented Programming

Maique Almeida maiquealmeida

🚜
Agribusiness Oriented Programming
View GitHub Profile
@maiquealmeida
maiquealmeida / README.MD
Last active August 18, 2022 03:41
AdonisJS: How to get separated auth for admin and user models

How to get separated auth for admin and user models

Let's say you have 2 models. App/Models/User and App/Models/Admin Inside your config/auth.js, you can create multiple authenticators for admin and user.

{
  user: {
    serializer: 'lucid',
    model: 'App/Models/User',
 scheme: 'session',
@maiquealmeida
maiquealmeida / android-gradle-fix
Created May 31, 2019 12:58
Fixing React-Native android release error: duplicate resource
doLast {
def moveFunc = { resSuffix ->
File originalDir = file("${resourcesDir}/drawable-${resSuffix}")
if (originalDir.exists()) {
File destDir = file("${resourcesDir}/drawable-${resSuffix}-v4")
ant.move(file: originalDir, tofile: destDir)
}
}
moveFunc.curry("ldpi").call()
moveFunc.curry("mdpi").call()
@maiquealmeida
maiquealmeida / App.js
Created August 23, 2019 21:57
Minhas melhores configurações do Apollo Client no React Native
import React from 'react';
import Routes from '~/routes';
import {ApolloProvider} from '@apollo/react-hooks';
import client from '~/services/apollo';
const App = () => {
return (
<ApolloProvider client={client}>
<PaperProvider theme={theme}>
@maiquealmeida
maiquealmeida / .env
Created September 19, 2019 12:53
Docker Compose file for up a MySQL dabatase environment and RedisDB
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=database_name
@maiquealmeida
maiquealmeida / .env
Last active October 24, 2019 21:00
Arquivo docker-compose para banco MySQL e Redis em ambiente dev
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=database
@maiquealmeida
maiquealmeida / apollo_service.js
Created November 19, 2019 09:00
Apollo Client service example.
import { ApolloClient } from "apollo-client";
import { ApolloLink } from "apollo-link";
import { HttpLink } from "apollo-link-http";
import { onError } from "apollo-link-error";
import { InMemoryCache } from "apollo-cache-inmemory";
import { getToken } from "./token";
import * as Toast from "./notification";
@maiquealmeida
maiquealmeida / .gitconfig
Created November 26, 2019 14:18
Minhas aliases para o GIT
[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}..)
@maiquealmeida
maiquealmeida / .env
Created December 2, 2019 21:58
Servidor MySQL5 e Redis com docker-compose v3
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=dbname
@maiquealmeida
maiquealmeida / ContentAware.js
Created December 4, 2019 17:40
React Native: Redução do formulário e movimentação em scroll até o campo selecionado
import React from 'react';
import {ScrollView} from 'react-native';
import { RootContainer, Content, Scroll } from './styles';
export default function ContentAware({rootStyle, contentStyle, children}) {
return (
<RootContainer style={rootStyle}>
<Scroll style={contentStyle}>
{children}
@maiquealmeida
maiquealmeida / howto.txt
Last active January 4, 2020 19:39
Automates git commit messages patterns.
Create a new file named commitlint.config.js with content:
module.exports = {
extends: ['@commitlint/config-conventional']
}
Add in package.json:
"husky": {
"hooks": {