Skip to content

Instantly share code, notes, and snippets.

View douglasjunior's full-sized avatar
:atom:
yarn start

Douglas Nassif Roma Junior douglasjunior

:atom:
yarn start
View GitHub Profile
@douglasjunior
douglasjunior / nginx.conf
Created May 14, 2024 23:07
Nginx config for SPAs
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
# X-Frame-Options is to prevent from clickJacking attack
add_header X-Frame-Options SAMEORIGIN;
# disable content-type sniffing on some browsers.
add_header X-Content-Type-Options nosniff;
@douglasjunior
douglasjunior / config-entries.js
Created November 2, 2023 18:08
config/entries.js
const fs = require('fs');
const path = require('path');
// Obtém o diretório raiz do projeto
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
// Obtém todos os arquivos (componentes) de entrada
const entryFiles = fs
.readdirSync(resolveApp('src/entries'))
@douglasjunior
douglasjunior / src-helpers-entries.js
Created November 2, 2023 18:04
src/helpers/entries.js
import React, { Suspense } from 'react';
import ReactDOM from 'react-dom/client';
window.renderReactComponent = window.renderReactComponent || {};
/**
* Define os providers a serem utilizados pelos componentes.
*
* Aqui podem ser declarados providers como o Redux, React Router, Style Theme, etc.
*/
@douglasjunior
douglasjunior / README.md
Last active July 6, 2022 12:04
Liberar espaço em disco no MacOS para desenvolvedores React Native
  1. Apagar node_modules, mas pra isso ser eficiente todos os seus projetos tem que estar dentro de uma mesma subpasta chamadas, exemplo: /home/user/projetos/.

Você entra na pasta /home/user/projetos/ pelo terminal e roda:

find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +

Se rodar esse comando em pasta errada pode acontecer dele apagar node_modules de dentro das pastas do NVM, ou alguma global, oq vai te forçar a reinstalar todas as versões do Node da sua máquina.

Apagar a pasta build dos projetos Android nativos, mesma regra aplicada ao node_modules:

@douglasjunior
douglasjunior / applyHighlight.js
Last active November 7, 2021 18:33
Função para destacar partes de um texto usando React
/**
* Função para destacar partes de um texto.
* Exemplo de uso:
* <span>
* {applyHighlight(text, highlight, { backgroundColor: 'yellow' })}
* </span>
*
* @param {string} text Texto
* @param {string|RegExp} highlight Parte do texto a ser destacada
* @param {object} options Propriedades do <span> para as partes destacadas
@douglasjunior
douglasjunior / config.fish
Last active October 28, 2019 13:30
Configure seu Fishshell para exibir informações sobre o repositório Git, assim como no Zsh.
set normal (set_color normal)
set magenta (set_color magenta)
set yellow (set_color yellow)
set green (set_color green)
set red (set_color red)
set gray (set_color -o black)
# Fish git prompt
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_showstashstate 'yes'
@douglasjunior
douglasjunior / IOSWifiManager.h
Last active August 13, 2024 07:12 — forked from rbresjer/IOSWifiManager.h
Programatically join Wi-Fi network on iOS with React Native wrapper for NEHotspotConfiguration
// Created by Rutger Bresjer on 10/10/2017
// Notes:
// - Be sure to enable "Hotspot Configuration" capability for the iOS target
// - Make sure the NetworkExtension framework is linked to the target
#import <Foundation/Foundation.h>
#import <React/RCTBridgeModule.h>
@interface IOSWifiManager : NSObject <RCTBridgeModule>
@douglasjunior
douglasjunior / Começando com Node JS e Express.md
Created July 30, 2017 16:00
Começando com Node JS e Express

Começando com Node JS e Express

  1. Instalar o Node JS 6.10 ou 6.11: https://nodejs.org/en/

  2. Verifique se o Node e o NPM foram instalados corretamente.

    Para verificar a versão do NPM:

    npm --version 
/**
* Created by douglas on 02/05/16.
*/
public final class TooltipGenerator {
private Activity activity;
private Dialog dialog;
private Context context;
private List<SimpleTooltip> tooltips = new ArrayList<>();
@douglasjunior
douglasjunior / EscPosHelper.java
Created May 29, 2017 20:48
EscPosHelper.java
import android.graphics.Bitmap;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
/**
* Created by douglas on 29/05/17.
* Adapted from http://new-grumpy-mentat.blogspot.com.br/2014/06/java-escpos-image-printing.html
*/