Skip to content

Instantly share code, notes, and snippets.

View AlbertoMonteiro's full-sized avatar
😎
Writting every day lines fo happy code

Alberto Monteiro AlbertoMonteiro

😎
Writting every day lines fo happy code
View GitHub Profile
@AlbertoMonteiro
AlbertoMonteiro / Program.cs
Created April 11, 2017 16:29
Start transaction with Microsoft.Extensions.DependencyInjection
using System;
using Microsoft.Extensions.DependencyInjection;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
var serviceCollection = new ServiceCollection();
@AlbertoMonteiro
AlbertoMonteiro / Email.cs
Created February 22, 2017 19:49
Mapeando tipos complex no EF sem problemas
namespace EfAndCpf
{
public class Email
{
public string EmailValue { get; private set; }
private Email()
{
}
@AlbertoMonteiro
AlbertoMonteiro / Sortear.cs
Created February 8, 2017 12:37
Sorteio Kart
var pessoas = new[] { "Douglas", "Cj", "Adn", "Alberto", "Miqueias", "Douglas C.", "Júnior Lessa", "Btn", "Psc", "Leandro", "Franklin" };
var r = new Random();
Console.WriteLine(string.Join(Environment.NewLine, pessoas.Select(p => Tuple.Create(p, r.Next())).OrderBy(t => t.Item2).Select((t, i) => $"{i + 1}. {t.Item1}")));
@AlbertoMonteiro
AlbertoMonteiro / instalação.md
Created November 22, 2016 12:43
Instalação de novos agentes de build no TeamCity
@AlbertoMonteiro
AlbertoMonteiro / CloneDbRDS.ps1
Created October 31, 2016 19:36
Clone Database in AWS RDS
param (
[string]$user,
[string]$pass,
[string]$server,
[string]$db,
[string]$newdb,
[boolean]$inaws=0
)
$env:PSModulePath = $env:PSModulePath + ";C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules\SQLPS"
@AlbertoMonteiro
AlbertoMonteiro / delete_order_version_elastic_beanstalk.js
Last active September 6, 2017 19:26
Script to delete order version of Elastic Beanstalk in AWS Console
jQuery("table").find("input[type=checkbox]").each((i,e) => { setTimeout(() => { if(i >= 100) jQuery(e).click(); }, 0); })
@AlbertoMonteiro
AlbertoMonteiro / IMonitorActor.cs
Created October 25, 2016 13:06
IMonitorActor.cs
using System;
using System.Diagnostics;
using Akka.Actor;
namespace TestMonitoring
{
public interface IMonitorActor
{
ActorTask OnStartReceive(string actorTypeName, string actorPath, object message);
void OnFinishReceive(ActorTask actorTask);
@AlbertoMonteiro
AlbertoMonteiro / Class1.cs
Created October 25, 2016 00:54
Discriminated Unions
using System;
using static EspecialTry.Helpers;
namespace EspecialTry
{
public class Try<TFailure, TSuccess>
{
internal TFailure Failure { get; }
internal TSuccess Success { get; }
@AlbertoMonteiro
AlbertoMonteiro / ConversionTest.cs
Created October 12, 2016 17:43
Object Mapper Benchmark
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection.Emit;
using AutoMapper;
using BenchmarkDotNet.Attributes;
using ExpressMapper.Extensions;
namespace AutoMapperBenchMark
@AlbertoMonteiro
AlbertoMonteiro / install.bat
Last active September 26, 2016 13:57
Application Insights
mkdir C:\temp
@powershell -NoProfile -ExecutionPolicy Bypass -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.microsoft.com/download/F/4/2/F42AB12D-C935-4E65-9D98-4E56F9ACBC8E/wpilauncher.exe', 'C:\\temp\\wpilauncher.exe')"
C:\temp\wpilauncher.exe
cd "C:\Program Files\microsoft\Web Platform Installer"
WebPICMD.exe /Install /Products:"ApplicationInsightsStatusMonitor" /AcceptEULA