Skip to content

Instantly share code, notes, and snippets.

View mauriciodarocha's full-sized avatar

Mauricio Rocha mauriciodarocha

View GitHub Profile
@mauriciodarocha
mauriciodarocha / formatNumberBR.js
Last active April 20, 2021 16:05
Formata o número com separação decimal no formato para o Brasil. "839,66,123,1,234,560.0000000001" => "839.661.231.234.560,0000000001"
/**
Converte número separados por vírgulas p/ pontos, e decimal por vírgula.
string valor
Ex. formatNumberBR("839,66,123,1,234,560.0000000001") => "839.661.231.234.560,0000000001"
*/
function formatNumberBR(valor) {
return valor.replace(/\./g, '|').replace(/,/g, '').replace(/(\d)(?=((\d{3})+)(?:\|))/g, '$1.').replace(/\|/g, ',');
}
@mauriciodarocha
mauriciodarocha / launch.json
Created June 13, 2021 23:54
Debug jsx test files in VSCode with Jest
{
"version": "0.2.0",
"configurations": [
{
"name": "1 - Debug CRA Tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
"runtimeArgs": [
"--inspect-brk",
@mauriciodarocha
mauriciodarocha / HttpServer.cs
Created May 29, 2023 20:12 — forked from define-private-public/HttpServer.cs
A Simple HTTP server in C#
// Filename: HttpServer.cs
// Author: Benjamin N. Summerton <define-private-public>
// License: Unlicense (http://unlicense.org/)
using System;
using System.IO;
using System.Text;
using System.Net;
using System.Threading.Tasks;