Skip to content

Instantly share code, notes, and snippets.

Avatar
☁️
Developing

Bruno Martins brunomartinspro

☁️
Developing
View GitHub Profile
@brunomartinspro
brunomartinspro / IJsonHttpClient.cs
Last active Jun 14, 2018
Generic JSON HttpClient
View IJsonHttpClient.cs
using System.Threading.Tasks;
namespace BrunoMartinsPro.Http
{
public interface IJsonHttpClient
{
/// <summary>
/// Add Request Headers
/// </summary>
/// <param name="name"></param>
@brunomartinspro
brunomartinspro / newSql.js
Last active Sep 10, 2020
Draw.io - SQL Plugin with SQL Server and MySQL Support
View newSql.js
/**
* Parse SQL CREATE TABLE. Simple initial version for community to improve.
*/
Draw.loadPlugin(function(ui) {
function TableModel() {
this.Name = null;
this.Properties = []
}
@brunomartinspro
brunomartinspro / IMicrosoftAspNetCoreIdentityUtils.cs
Last active Jun 11, 2018
Generate User Two Factor Security Code from Microsoft.AspNetCore.Identity
View IMicrosoftAspNetCoreIdentityUtils.cs
using System.Threading.Tasks;
using BrunoMartinsPro.Data.Models;
namespace BrunoMartinsPro.Utils.MicrosoftAspNetCoreIdentity
{
public interface IMicrosoftAspNetCoreIdentityUtils
{
Task<string> GenerateUserTwoFactorSecurityCode(ApplicationUser user, string securityType);
}
}
@brunomartinspro
brunomartinspro / AutoMapperProfile.cs
Created Jun 11, 2018
Configure AutoMapper in ASP.NET Core
View AutoMapperProfile.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using BrunoMartinsPro.Models.Report;
using BrunoMartinsPro.DTO.Report;
namespace BrunoMartinsPro.Config
{
@brunomartinspro
brunomartinspro / CSVUtils.cs
Created Jun 12, 2018
Generic CSV Export using CSVHelper
View CSVUtils.cs
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CsvHelper;
using BrunoMartinsPro.Data.Interfaces.Utils.CSV;
@brunomartinspro
brunomartinspro / DocumentModel.cs
Last active Jun 13, 2018
Convert property to a enum from a XML Object
View DocumentModel.cs
namespace BrunoMartinsPro
{
public class DocumentModel
{
public long DocumentId { get; set; }
public MetadataModel Metadata { get; set; }
}
}
@brunomartinspro
brunomartinspro / ADUtils.cs
Last active Jun 21, 2018
Get Active Active Directory Users based on List of usernames
View ADUtils.cs
using System;
using System.Linq;
using System.Collections.Generic;
using System.DirectoryServices;
using BrunoMartinsPro.Data.Interfaces.Utils.ActiveDirectory;
namespace BrunoMartinsPro.Utils.ActiveDirectory
{
public class ADUtils : IADUtils
{
@brunomartinspro
brunomartinspro / MSSQLServiceBrokerUtils.sql
Last active Jul 5, 2018
SQL Server Service Broker Utils
View MSSQLServiceBrokerUtils.sql
-- Verify the state of the service broker in SQL Server Management Studio
-- Database -> Properties -> Options -> Service Broker Tab -> Broker Enabled
-- To enable broker
ALTER DATABASE [database] SET ENABLE_BROKER
-- To disable broker
ALTER DATABASE [database] SET DISABLE_BROKER
-- When having multiple service brokers, each service broker must have an unique identifier to run.
@brunomartinspro
brunomartinspro / Startup.cs
Last active Jul 9, 2018
[ASP.NET Core] Enable HTTPS rewrite
View Startup.cs
...
using Microsoft.AspNetCore.Mvc
using Microsoft.AspNetCore.Rewrite;
using Microsoft.Extensions.Primitives;
namespace BrunoMartinsPro.Startup
{
public class Startup
{
@brunomartinspro
brunomartinspro / Startup.cs
Created Jul 9, 2018
[ASP.NET Core] Deactivate default authentication challenge (Account/Login)
View Startup.cs
...
namespace BrunoMartinsPro.Startup
{
public class Startup
{
...
public Startup(IHostingEnvironment env)
{