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 / ObjectSpread.cs
Created February 14, 2018 23:24
Spread object in C#
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
namespace Playground
{
public class Program
public interface IUnitOfWork : IDisposable
{
#region UoW
Database Database { get; }
DbChangeTracker ChangeTracker { get; }
DbContextTransaction Transaction { get; }
DbContextConfiguration Configuration { get; }
DbSet Set(Type entityType);
DbSet<T> Set<T>() where T : class;
int SaveChanges();
@AlbertoMonteiro
AlbertoMonteiro / disableconstraints.sql
Created December 20, 2017 20:25
Disable constrains SQL Server
EXEC sp_msforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT all'
EXEC sp_msforeachtable 'ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all'
@AlbertoMonteiro
AlbertoMonteiro / docker events output.md
Last active December 13, 2017 18:01
Docker very slow
2017-12-13T15:00:18.059385800-03:00 container create 07b3ae560d416356673e4fa8ae1a2bd4fe6ebf69a3f5e35fd015fb30f3236d52 (image=microsoft/dotnet-framework, name=sleepy_gates)
2017-12-13T15:00:18.066377500-03:00 container attach 07b3ae560d416356673e4fa8ae1a2bd4fe6ebf69a3f5e35fd015fb30f3236d52 (image=microsoft/dotnet-framework, name=sleepy_gates)
2017-12-13T15:00:18.129877400-03:00 network connect e47d6abe799d43547cad0f7bb60ee0ab0525b169af5da925fa2d2fcf789f9afd (container=07b3ae560d416356673e4fa8ae1a2bd4fe6ebf69a3f5e35fd015fb30f3236d52, name=none, type=null)
2017-12-13T15:00:47.920780100-03:00 container start 07b3ae560d416356673e4fa8ae1a2bd4fe6ebf69a3f5e35fd015fb30f3236d52 (image=microsoft/dotnet-framework, name=sleepy_gates)
2017-12-13T15:00:50.979503000-03:00 container die 07b3ae560d416356673e4fa8ae1a2bd4fe6ebf69a3f5e35fd015fb30f3236d52 (exitCode=0, image=microsoft/dotnet-framework, name=sleepy_gates)
2017-12-13T15:00:51.000501000-03:00 network disconnect e47d6abe799d43547cad0f7bb60ee0ab0525b169af5da925fa2d2
@AlbertoMonteiro
AlbertoMonteiro / comandos.md
Created December 13, 2017 12:57
Docker sucesso
docker run -it --mount source=my-vol,target=c:/app microsoft/dotnet-framework powershell
docker network ls
docker volume create my-vol
docker volume inspect my-vol
@AlbertoMonteiro
AlbertoMonteiro / Program.cs
Last active December 11, 2017 14:32
EF com IEnumerable gerando Multiple Enumeration
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.SqlClient;
using System.Linq;
namespace ConsoleApp5
{
class Program
@AlbertoMonteiro
AlbertoMonteiro / run.ps1
Created November 1, 2017 18:57
Remover arquivos com powershell
[regex]$reg = "(?<name>.+?)(\.\d+){3,4}\.nupkg$";
ls *.nupkg | sort -Descending | group { $reg.Match($_.Name).Groups["name"].Value } | where { $_.count -gt 1 } | % { $_.group | select -Skip 5 } | del
@AlbertoMonteiro
AlbertoMonteiro / Program.cs
Created October 31, 2017 20:34
Complex model resolution with raw query using Entity Framework and Slapper.AutoMapper
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Dynamic;
using System.Linq;
namespace EfSqlQueryTree
{
class Program
{
@AlbertoMonteiro
AlbertoMonteiro / index.js
Created October 27, 2017 02:51
Sell player for futbin prince + 100
// ==UserScript==
// @name Sell for futbin value
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Alberto Monteiro
// @match https://www.easports.com/fifa/ultimate-team/web-app/*
// @match https://www.easports.com/*/fifa/ultimate-team/web-app/*
// @updateURL https://gist.github.com/AlbertoMonteiro/273b47dcf656406bd168afb1f8245dcc
// @downloadURL https://gist.github.com/AlbertoMonteiro/273b47dcf656406bd168afb1f8245dcc
@AlbertoMonteiro
AlbertoMonteiro / Program.cs
Created October 16, 2017 20:52
Descobrir propriedades string na arvore de um type
using System;
namespace ConsoleApp2
{
class Program
{
private static readonly Type StringType = typeof(string);
static void Main(string[] args)
{