Skip to content

Instantly share code, notes, and snippets.

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

Bruno Dantas brunotdantas

🏠
Working from home
View GitHub Profile
@brunotdantas
brunotdantas / validateCPF.js
Created November 21, 2022 19:29
Validate CPF (BR GOVERNMENT UNIQUE ID)
// source: https://www.devmedia.com.br/validar-cpf-com-javascript/23916
function TestaCPF(strCPF) {
var Soma;
var Resto;
Soma = 0;
if (strCPF == "00000000000") return false;
for (i=1; i<=9; i++) Soma = Soma + parseInt(strCPF.substring(i-1, i)) * (11 - i);
Resto = (Soma * 10) % 11;
@brunotdantas
brunotdantas / Program.cs
Created October 23, 2022 19:19
tictactoe_csharp
using System;
internal class Program
{
private static void Main(string[] args)
{
//-------- CODE HERE
Console.Title = "The Point";
Console.Clear();
@brunotdantas
brunotdantas / programming_links.md
Created October 23, 2022 00:12
Useful links to study or check for languages snippets or docs that i'm interested on
@brunotdantas
brunotdantas / Poketrumps.cs
Last active October 18, 2022 07:44
PokeTrumps is a program where the user can select one attribute of its current card and if that attribute is bigger than his rival he scores, at the end of 5 rounds we check points.
internal class Program
{
private static void Main(string[] args)
{
Console.Title = "PokeTrumps";
Console.Clear();
Console.WriteLine("---------------------------------------------------------------------------------------------------------------");
Console.WriteLine("Hello my friend! Welcome to PokeTrumps!");
@brunotdantas
brunotdantas / pessoas.json
Created March 3, 2022 02:16
90 Pessoas Brasileiras Fake Para testes
[
{
"nome": "Alessandra Luzia Nogueira",
"idade": 70,
"cpf": "827.565.258-80",
"rg": "18.847.105-4",
"data_nasc": "07/01/1952",
"sexo": "Feminino",
"signo": "Capricórnio",
"mae": "Rosângela Sophia",
@brunotdantas
brunotdantas / estados-cidades.json
Created March 3, 2022 02:08 — forked from letanure/estados-cidades.json
JSON estados cidades do brasil, dividido por estados. segunda lista atualizada em 2020, dados do IBGE
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@brunotdantas
brunotdantas / MSSQL_RepetitiveReplace_fn.sql
Created January 28, 2022 14:59 — forked from jkdba/MSSQL_RepetitiveReplace_fn.sql
Simple function to recursively replace a pattern in a string.
CREATE FUNCTION dbo.RepetitiveReplace_fn
(
@P_String VARCHAR(MAX),
@P_Pattern VARCHAR(MAX),
@P_ReplaceString VARCHAR(MAX),
@P_ReplaceLength INT = 1
)
RETURNS VARCHAR(MAX)
BEGIN
DECLARE @Index INT;
@brunotdantas
brunotdantas / mapsqlserver.sql
Last active December 23, 2021 17:46
SQL SERVER - MAP PROCEDURES AND FUNCTIONS COLUMNS AND TABLES
-- 23/12/2021 - Bruno
drop table if exists #resouce_mapping ;
select distinct
s.name as schema_name
,o.type_desc as resource_type
,p.name as resource_name
,t.name as table_name
,c.name as column_name
,ty.name as type
,c.max_length
@brunotdantas
brunotdantas / gist:58fe9180ec4c5528e5318516877ac503
Created November 19, 2021 01:03
POWER BI - Tabela calendário DAX
dCalendario =
ADDCOLUMNS(
CALENDARAUTO();
"Ano";FORMAT([Date];"yyyy");
"Trimestre";FORMAT([Date];"q");
@brunotdantas
brunotdantas / BotTelegram.py
Created October 6, 2021 17:36
BotTelegram
#fonte https://devaprender.com/como-criar-um-bot-no-telegram/
import requests
import time
import json
import os
class TelegramBot:
def __init__(self):
token = 'seutoken'