Skip to content

Instantly share code, notes, and snippets.

View SafraPC's full-sized avatar
😄

Leandro Safra SafraPC

😄
  • Campinas / São Paulo
View GitHub Profile
@SafraPC
SafraPC / DecimalSeparatorRegex.txt
Created March 2, 2022 13:31
Regex to add Decimal Separators
var number = 100000000000000000000;
console.log(number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','));
regex: (/\B(?=(\d{3})+(?!\d))/g, ',')
@SafraPC
SafraPC / RUN_C_COMPILER_IN_TERMINAL.txt
Created September 4, 2021 14:57
Tenho tido muitos problemas para rodar qualquer código C por alguma IDE, seja o codeblocks, devc++ ou o vscode com extensão. dessa forma , basta entrar no diretório do arquivo que está localizado .c e rodar os comandos:
gcc your_program.c && ./a.out
@SafraPC
SafraPC / user-login.test.js
Last active April 19, 2021 11:38
Create Jest Test TDD file
describe("Validing User Login", () => {
it("should return true if login is valid", () => {
const loginVar = "jonas@gmail.com";
const senhaVar = "123456";
function login(loginp: string, passwordp: string) {
return loginp && passwordp.length > 4;
}
expect(login(loginVar, senhaVar)).toBe(true);
});
});
@SafraPC
SafraPC / nodeExpressTSApp.txt
Created February 26, 2021 21:39
Create Node app with Express Framework and Typescript
for create package.json
yarn init -y
convert typescript to js more fast than babel and add ts
yarn add -D typescript sucrase
create folder src and add server.ts there
create into package.json
"scripts": {
@SafraPC
SafraPC / createReactApp.txt
Created February 26, 2021 16:07
Create an React app with typescript, prettier and eslint
In CMD linked in your project folder:
yarn create react-app . --template typescript
yarn add -D eslint-config-prettier eslint-plugin-prettier @typescript-eslint/eslint-plugin @typescript-eslint/parser
yarn add styled-components
@SafraPC
SafraPC / How open a JFrame in center of monitor with JAVA.txt
Created February 13, 2021 21:21
Open JFrame in Center of Monitor JAVA
How open a JFrame in center of monitor with JAVA
---CODE---
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;
@SafraPC
SafraPC / dockerBasicCommands.txt
Last active January 19, 2021 12:17
Docker basic commands for begginers
#get an image
sudo docker pull redis:6.0.10-alpine
#List images
sudo docker images
#run an image
sudo docker run -d -p 6379:6379 -i -t redis:6.0.10-alpine
#list the image who is running
sudo docker ps
#close the image and procces of BD
sudo docker stop <ID>
#COPY BY diego3g
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
export ANDROID_HOME=~/Android/Sdk
export PATH="$PATH:$ANDROID_HOME/tools"
export PATH="$PATH:$ANDROID_HOME/platform-tools"
# Path to your oh-my-zsh installation.
export ZSH="/Users/diegofernandes/.oh-my-zsh"
@SafraPC
SafraPC / styles.css
Last active January 6, 2021 21:56
Variable Roots CSS
:root {
--color-background: #121214;
--color-green: #04d361;
--color-red: #e83f5b;
--color-orange: #fd951f;
--color-yellow: #f7df1e;
--color-primary: #8257e6;
--color-primary-hover: #9466ff;
--color-secondary: #e1e1e6;
--color-text: #a8a8b3;