Skip to content

Instantly share code, notes, and snippets.

View maiquealmeida's full-sized avatar
🏠
Working from home

Maique Almeida maiquealmeida

🏠
Working from home
View GitHub Profile
@maiquealmeida
maiquealmeida / strapi-change-password-script.js
Created February 10, 2021 14:50
Altera a senha de um usuario administrador do Strapi através do console.
// Altere o script e cole ele no console do strapi.
// npx strapi console
function changePassword(email, password) {
strapi.admin.services.user.findOne({ email: email }).then(user => {
if (user) {
strapi.admin.services.auth.hashPassword(password).then(hashedPassword => {
strapi.query('user', 'admin').update({ id: user.id }, { password: hashedPassword })
.then(() => console.log('Atualizado com sucesso.'))
.catch((err) => console.error('Erro ao atualizar a senha.', err))
@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": {
@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 / .env
Created December 2, 2019 21:58
Servidor MySQL5 e Redis com docker-compose v3
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=dbname
@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 / 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 / .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 / .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 / 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 / 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()