Skip to content

Instantly share code, notes, and snippets.

@bruno-garcia
bruno-garcia / AssemblyExtensions.cs
Last active April 14, 2018 15:02
Is .NET assembly optimized
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
[EditorBrowsable(EditorBrowsableState.Never)]
internal static class AssemblyExtensions
{
/// <summary>
/// Whether the assembly was compiled with the optimize+ flag
/// </summary>

Keybase proof

I hereby claim:

  • I am bruno-garcia on github.
  • I am brunogarcia (https://keybase.io/brunogarcia) on keybase.
  • I have a public key ASCwN-0tPUXeUT287EntKXJ-lI2FFSi3bJ9EZS-LDMce_Ao

To claim this, I am signing this object:

class Program
{
static void Main()
{
var a = 1;
ref var b = ref Increment(ref a);
b++;
var c = Increment(ref b);
c++;
System.Console.WriteLine($@"a: {a}
[Fact]
public void Serialize_NullObject_ThrowsNullArgument()
{
var sut = new MessagePackSerializer(new MessagePackOptions());
Assert.Throws<ArgumentNullException>(() => { sut.Serialize((object) null); });
}
[Fact]
public void Serialize_NullObject_ThrowsNullArgument()
{
var sut = new MessagePackSerializer(new MessagePackOptions());
Assert.Throws<ArgumentNullException>(() => sut.Serialize((object) null));
}
@bruno-garcia
bruno-garcia / iserializer-span-of-t.cs
Last active December 3, 2017 23:06
ISerializer with ReadOnlySpan<T>
public interface ISerializer
{
ReadOnlySpan<byte> Serialize<T>(T @object);
object Deserialize(Type type, ReadOnlySpan<byte> bytes);
}
@bruno-garcia
bruno-garcia / coverage.ps1
Created December 2, 2017 12:03
.NET Core Open Cover powershell script
Param (
[switch] $generateReport,
[switch] $uploadCodecov
)
$currentPath = Split-Path $MyInvocation.MyCommand.Path
$coverageOutputDirectory = Join-Path $currentPath "coverage"
$coverageFile = "coverage-results.xml"
Remove-Item $coverageOutputDirectory -Force -Recurse -ErrorAction SilentlyContinue
@bruno-garcia
bruno-garcia / .appveyor.yml
Created December 1, 2017 19:16
.NET Core AppVeyor build configuration (Greentube.Messaging)
version: '1.0.0-alpha-{build}'
init:
- git config --global core.autocrlf true
# If there's a tag, use that as the version.
- ps: >-
if($env:APPVEYOR_REPO_TAG -eq "true"){Update-AppveyorBuild -Version "$env:APPVEYOR_REPO_TAG_NAME"}
# Will build dependencies in release (optimize and portable pdbs) mode:
build_script:
- cmd: for /f %%a in ('dir /b test') do dotnet test -c Release test/%%a/%%a.csproj
after_build:
@bruno-garcia
bruno-garcia / .travis.yml
Created December 1, 2017 19:03
.NET Core Travis-CI build configuration (Greentube.Messaging)
language: csharp
sudo: false
mono: none
os:
- linux
- osx
osx_image: xcode8.1
dotnet: 2.0.0
dist: trusty
env:
@bruno-garcia
bruno-garcia / XGH - PT-BR.txt
Created November 16, 2016 12:06 — forked from banaslee/XGH - en.txt
eXtreme Go-Horse Process
Fonte: http://gohorseprocess.wordpress.com
1- Pensou, não é XGH.
XGH não pensa, faz a primeira coisa que vem à mente. Não existe
segunda opção, a única opção é a mais rápida.
2- Existem 3 formas de se resolver um problema, a correta, a errada e
a XGH, que é igual à errada, só que mais rápida.