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
filters.Add(new RollbarMvcExceptionFilter());
using System;
using System.Threading.Tasks;
using Microsoft.Owin.Hosting;
using Nancy;
using Owin;
namespace ConsoleApplication1
{
class Program
{
public class ValuesController : ApiController
{
// GET api/values
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
public string Get(int id)
[user]
name = Alberto Monteiro
email = [email protected]
[core]
preloadindex = true
fscache = true
autocrlf = true
editor = code -n -w
[alias]
fetchall = fetch --all --prune
@AlbertoMonteiro
AlbertoMonteiro / gist:671eddab7d61390a9d09
Created December 11, 2014 18:34
Customizando de forma flexível o nome das colunas usando CsvHelper
using CsvHelper;
using CsvHelper.Configuration;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq.Expressions;
using Xunit;
namespace ClassLibrary1
{
@AlbertoMonteiro
AlbertoMonteiro / EnumerableAlberto.cs
Last active August 29, 2015 14:10
Resposta Sergio
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
namespace Sergio
{
public class EnumerableAlberto
@AlbertoMonteiro
AlbertoMonteiro / NetworkShareAccesser.cs
Created October 31, 2014 18:24
Classe para permitir o acesso a diretorios na rede usando credenciais do Active Directory
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
namespace ConsoleApplication5
{
/// <summary>
/// Provides access to a network share.
/// </summary>
public class NetworkShareAccesser : IDisposable
@AlbertoMonteiro
AlbertoMonteiro / LinqExtensions.cs
Last active August 29, 2015 14:07
Cool Linq Extensions
static class Ex
{
public static TimeSpan Sum(this IEnumerable<TimeSpan> lista)
{
return lista.Aggregate(TimeSpan.Zero, (current, item) => current.Add(item));
}
public static TValue Aggregate<T, TValue>(this IEnumerable<T> lista, TValue initial, Func<T, int, TValue, TValue> aggregateFunc)
{
var i = 0;
Tags with inner tags => <(Content|None|Compile|EmbeddedResource).+?[^/]>(\n+\s+.+){1,6}?(\n\s+</\1>)
@AlbertoMonteiro
AlbertoMonteiro / InserindoVariosDoCSVViaEF.cs
Last active August 29, 2015 14:07
Inserindo Varios DoCSV via EF
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApplication1