Skip to content

Instantly share code, notes, and snippets.

View CristianoRC's full-sized avatar
🧉

Cristiano Raffi Cunha CristianoRC

🧉
View GitHub Profile
@CristianoRC
CristianoRC / OpenRedirectSameOrigin.js
Created August 26, 2024 19:45
Código para correção de Open Redirect, permitindo apenas mesma origem ou páginas internas
const isUrl = (url) => {
try {
new URL(url);
return true;
} catch {
return false;
}
};
const isSameOrigin = (url) => {
@CristianoRC
CristianoRC / Template.md
Last active July 15, 2021 12:43
Template de slide para o RevealJS
theme transition title enableMenu enableSearch enableChalkboard
night
slide
Banco de dados
false
false
false

Sldie 1

alias UpgradeSystem='sudo apt-get update;
sudo apt-get dist-upgrade -f;
sudo apt-get autoclean;
sudo apt-get autoremove;
sudo apt-get clean'
alias EscutarMicrofone='pactl load-module module-loopback latency_msec=1'
alias NaoEscutarMicrofone='pactl unload-module module-loopback'
alias DeletarNoneImages='docker rmi $(docker images --filter "dangling=true" -q --no-trunc)'
#!/bin/bash
REPOSITORY_DIR="$PWD/"
CHALLENG=$1
RESULT_DIR=${REPOSITORY_DIR}/.trybe/expected-results
RESULT_BKP_DIR=${REPOSITORY_DIR}/.trybe/expected-results-bkp
EVALUETE_FILE=${REPOSITORY_DIR}/scripts/evaluate.sh
mv $RESULT_DIR $RESULT_BKP_DIR
mkdir $RESULT_DIR
@CristianoRC
CristianoRC / ReportGenerator.sh
Created February 16, 2021 12:53
Script para automatizar saida do report generator .NET Core
#!/bin/sh
rm -rf resultados
rm -rf coveragereport
dotnet test --collect:"XPlat Code Coverage" --results-directory:"./resultados/"
folder_guid=$(ls resultados)
path_result="$(pwd)/resultados/${folder_guid}/coverage.cobertura.xml"
#Cria relatorio HTML
reportgenerator "-reports:${path_result}" "-targetdir:coveragereport" -reporttypes:Html
@CristianoRC
CristianoRC / Dicas-JS
Last active September 18, 2020 20:41
- Event Loop
- Async Await
- Promise
- CallBack
- Clean Code -DAR UMA GRANDE ATENÇÃO PARA ISSO!
- SOLID
- Testes unitários
- Como funciona o HTTP(Se quiserem tenho livro para mandar)
- Saber as principais funções em listas(map, filter, reduce, find, findeIndex...)
- Spread Operator
@CristianoRC
CristianoRC / Dockerfile
Created July 20, 2020 11:09
Docker SQL Server with Full-Text Search (FTS)
FROM mcr.microsoft.com/mssql/server:2017-latest
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y curl && \
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list | tee /etc/apt/sources.list.d/mssql-server-2017.list && \
apt-get update
RUN apt-get install -y mssql-server-fts
@CristianoRC
CristianoRC / basico.test.js
Created October 13, 2019 11:09
Exemplos do Jest
describe('Função de soma', () => {
it('Deve somar o numero passado por parâmetro com 1', () => {
expect((adicionarUm(10))).toBe(11)
})
})
test('O Array deve ser preenchido da maneira correta', () => {
const numeros = { um: 1 };
numeros['dois'] = 2;
numeros['tres'] = 3
using System;
namespace explicitCast
{
class Program
{
static void Main(string[] args)
{
var real = new Real(459);
var dolar = (Dolar)real;
public class Dolar
{
public Dolar(decimal valor)
{
Valor = valor;
Nome = "United States dollar";
Codigo = "USD";
}
public string Nome { get; private set; }