Skip to content

Instantly share code, notes, and snippets.

View ThiagoBarradas's full-sized avatar
👽
em marte!

Thiago Barradas ThiagoBarradas

👽
em marte!
View GitHub Profile
@ThiagoBarradas
ThiagoBarradas / sonarqube-dotnet-send-analysis-and-code-coverage.sh
Created March 25, 2019 16:07
Sonarqube - send dotnet code analysis and code coverage
# Install sonarqube scanner / reporter
dotnet tool install --global dotnet-sonarscanner
# Install dotnet tools to generate test report
dotnet tool install --global coverlet.console
dotnet add package coverlet.msbuild
# Start sonarqube process
dotnet build-server shutdown
dotnet sonarscanner begin /o:${SONAR_ORG_KEY} /k:${SONAR_PROJECT_KEY} /v:${VERSION} /d:sonar.host.url=https://sonarcloud.io /d:sonar.login=${SONAR_TOKEN} /d:sonar.cs.opencover.reportsPaths="opencover.xml"
@ThiagoBarradas
ThiagoBarradas / codeclimate-dotnet-send-code-coverage.sh
Last active August 11, 2023 20:10
CodeClimate - send dotnet code coverage
# Download codeclimate test reporter
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./codeclimate-test-reporter
chmod +x ./codeclimate-test-reporter
# Install dotnet tools to generate test report
dotnet tool install --global coverlet.console
dotnet add package coverlet.msbuild
# Start codeclimate process
./codeclimate-test-reporter before-build
@ThiagoBarradas
ThiagoBarradas / solid-D-wrong2.cs
Last active June 8, 2023 21:51
SOLID [D] - Wrong implementation with high coupling
public class CreditCard
{
public bool Pay(int amount)
{
// do something
}
}
public class Person
{
@ThiagoBarradas
ThiagoBarradas / solid-S-splitting-class.cs
Last active June 8, 2023 21:10
SOLID [S] - Splitting class (Class with SRP)
public class PaymentService : IPaymentService
{
private readonly IPaymentRepository PaymentRepository;
private readonly INotificationService NotificationService;
private readonly IBankService BankService;
public PaymentService(
IPaymentRepository paymentRepository,
@ThiagoBarradas
ThiagoBarradas / solid-I-interfaces-example-3.cs
Last active June 8, 2023 20:07
SOLID [I] - Interface Example with segmented behavior
public interface ITalkative
{
void Speak(string message);
}
public interface IMovable
{
void Move(long x, long y, long z);
}
@ThiagoBarradas
ThiagoBarradas / xunit-theory-memberdata.cs
Last active March 6, 2023 17:50
xUnit Theory MemberData Sample
// models for example
public class SendEmailModel
{
public string Content { get; set; }
public string Email { get; set; }
}
public class SendEmailResult
// users?page=1&size=10
{
"items" : [
{
// ...
"links": [
{
"label": "Deletar Usuário",
@ThiagoBarradas
ThiagoBarradas / person.json
Created March 16, 2022 17:09
person.json
{
"firstName": "John",
"lastName": "Smith",
"age": 25,
"address":
{
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021"
@ThiagoBarradas
ThiagoBarradas / jose.js
Created March 5, 2022 06:54
jose.js single file
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({},{},[])
/*
* jsrsasign(all) 10.5.8 (2022-02-25) (c) 2010-2021 Kenji Urushima | kjur.github.io/jsrsasign/license
*/
/*! CryptoJS v3.1.2 core-fix.js
* code.google.com/p/crypto-js
* (c) 2009-2013 by Jeff Mott. All rights reserved.
* code.google.com/p/crypto-js/wiki/License
* THIS IS FIX of 'core.js' to fix Hmac issue.
* https://code.google.com/p/crypto-js/issues/detail?id=84