Skip to content

Instantly share code, notes, and snippets.

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

Igor Ming de Mesquita IgorMing

🏠
Working from home
View GitHub Profile
@IgorMing
IgorMing / store.ts
Created October 20, 2020 03:05
a quick way to check how to configure redux, redux-thunk and reactotron
import { applyMiddleware, compose, createStore } from 'redux';
import thunkMiddleware from 'redux-thunk';
import rootReducer from './reducers';
import reactotron from '../reactotron.config';
export default createStore(
rootReducer,
compose(applyMiddleware(thunkMiddleware), reactotron.createEnhancer())
);
@IgorMing
IgorMing / metro.config.js
Created October 14, 2020 22:29
required configuration for load svg files into your react native project
const { getDefaultConfig } = require('metro-config');
module.exports = (async () => {
const {
resolver: { sourceExts, assetExts }
} = await getDefaultConfig();
return {
transformer: {
getTransformOptions: async () => ({
transform: {
@IgorMing
IgorMing / boilerplate.md
Last active May 30, 2020 17:21
A simple guide to follow while starting a new project

Project guide

The following suggestions are personal. That's how I like to go while I'm starting a React/React Native project.

Step by step

JS or TS?

Decide whether you want to use plain Javascript or Typescript

@IgorMing
IgorMing / novo_produto.md
Last active September 27, 2019 18:54
Descritivo para seguir de base em criações de novos produtos

Criação de um produto

Descritivos

  • O que é o produto?
  • Qual problema ele resolve?
  • Modelo de negócio
  • Públicos alvo
  • Criação de personas (desejável)
@IgorMing
IgorMing / prettier_eslint.md
Last active April 26, 2019 23:34
Simple steps for prettier + eslint configuration

How to configure Prettier + ESLint in VSCode

Motivation

Prettier is quite useful for format your code automatically, making you concern only with coding (which is what really matters)

ESLint has some personal rules, that makes your code have a particular pattern, where you can configure everything that you and the whole team will whose in project by default

Sometimes, you use prettier, and it has a personal pattern to deal with the styleguide. And those rules and patterns could conflict with project's ESLint rules. Looking at this problem, you can follow below some steps to configure a kind of integration between both tools.

@IgorMing
IgorMing / customWords.js
Last active May 6, 2018 20:46
Almost like my wordWrapper function, but a function to create custom words (I've created it to work with React Native)
function customWords(text, customStyles, ...wordsToWrap) {
// Pattern to be considered to split every word
const regexp = /([\A-zÀ-ÿ]+|([!.,:?]))/gi;
// Separate the phrase with all the words and characters "!.,:?"
const splittedText = text.match(regexp);
// Convert everything for lower case, to compare it correctly
// and breaking words to wrap even if it contains some compound word
const splittedWordsToWrap = wordsToWrap.reduce((acc, curr) => {
@IgorMing
IgorMing / wordWrapper.js
Last active May 6, 2018 19:24
A function which can help you to do something in a phrase in either specific words or specific parts from the phrase.
function wordWrapper(text, wrapperFunc, ...wordsToWrap) {
// Separate the phrase with all the words and characters "!.,:?"
const splittedText = text.match(/([\A-zÀ-ÿ]+|([!.,:?]))/gi);
// Convert everything for lower case, to compare it correctly
const lowerWords = wordsToWrap.map(each => each.toLowerCase());
// Wrap every word doing what the function suggests to do
const wrappedSplittedText = splittedText.reduce((acc, curr) => {
acc.push(lowerWords.includes(curr.toLowerCase()) ? wrapperFunc(curr) : curr);
@IgorMing
IgorMing / .editorconfig
Created February 25, 2018 00:17
Editorconfig file just with useful stuff
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# Indentation override for all JS under lib directory
[**.{js,json}]
@IgorMing
IgorMing / normalizer.js
Created November 27, 2017 15:20
Simple normalizer
function normalize(array, key) {
return array.reduce((acc, curr) => {
acc.all[curr[key]] = curr;
acc.ids.push(curr[key]);
return { ...acc };
}, { all: {}, ids: [] });
}
@IgorMing
IgorMing / barcodescanner.js
Last active October 19, 2024 20:55
Barcode Scanner on React Native (with expo), stylized with opaque edges
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { BarCodeScanner } from 'expo';
export default class App extends React.Component {
render() {
return (
<BarCodeScanner
onBarCodeRead={(scan) => alert(scan.data)}
style={[StyleSheet.absoluteFill, styles.container]}