Skip to content

Instantly share code, notes, and snippets.

View fekberg's full-sized avatar

Filip Ekberg fekberg

View GitHub Profile
@fekberg
fekberg / Pattern Matching in C# 8.0
Created March 19, 2020 13:31
Pattern Matching.cs
using System;
using System.Drawing;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
namespace Recrusive_Patterns
{
class Program
{
ERROR [2018-05-14 09:46:20Z]:ERROR [2018-05-14 09:46:20Z]: MSBuild property evaluation failed: [Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries($(TargetFrameworkIdentifier), $(TargetFrameworkVersion), $(TargetFrameworkProfile), $(PlatformTarget), $(TargetFrameworkRootPath))
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Microsoft.Build.Collections.MSBuildNameIgnoreCaseComparer' threw an exception. ---> System.EntryPointNotFoundException: GetSystemInfo
at (wrapper managed-to-native) Microsoft.Build.Shared.NativeMethodsShared.GetSystemInfo(Microsoft.Build.Shared.NativeMethodsShared/SYSTEM_INFO&)
at Microsoft.Build.Shared.NativeMethodsShared+SystemIn
@fekberg
fekberg / keybase.md
Created May 27, 2015 00:07
Keybase.io

Keybase proof

I hereby claim:

  • I am fekberg on github.
  • I am fekberg (https://keybase.io/fekberg) on keybase.
  • I have a public key whose fingerprint is 3F13 5660 D328 9CBA CE2D 14CF A178 38E3 F9BB 0A1C

To claim this, I am signing this object:

@fekberg
fekberg / Keybase.io
Created May 27, 2015 00:05
Keybase.io
```
And finally, I am proving ownership of the github account by posting this as a gist.
### My publicly-auditable identity:
https://keybase.io/fekberg
### From the command line:
```
And finally, I am proving ownership of the github account by posting this as a gist.
### My publicly-auditable identity:
https://keybase.io/fekberg
### From the command line:
@fekberg
fekberg / deadlock.cs
Last active August 29, 2015 14:17
U NO DEADLOCK?!
/* Android - DOES NOT DEADLOCK */
Task.Run(() =>{
Thread.Sleep(2000);
RunOnUiThread(() => { });
}).Wait();
/* iOS - DEADLOCKS */
Task.Run(() =>{
Thread.Sleep(2000);
InvokeOnMainThread(() => { });
using System.IO;
using System.Linq;
namespace CopyToOneDrive
{
internal class Program
{
private const string _destination = @"C:\Users\YourUserName\OneDrive\Camera Roll";
private const string _source = @"D:\Camera Roll Backup\";
@fekberg
fekberg / Ensure.That.Performance
Created June 4, 2014 23:23
Performance test for Ensure.That
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EnsureThat.Performance
{
class Program
@fekberg
fekberg / DepthFirstSearch.cs
Last active August 29, 2015 13:56
Depth First Search
void Main()
{
// Define all the vertices in the graph
var a = new Vertex<string>{ Value = "A" };
var b = new Vertex<string>{ Value = "B" };
var c = new Vertex<string>{ Value = "C" };
var d = new Vertex<string>{ Value = "D" };
var e = new Vertex<string>{ Value = "E" };
var f = new Vertex<string>{ Value = "F" };
var g = new Vertex<string>{ Value = "G" };
@fekberg
fekberg / FancyDictionary.cs
Last active August 29, 2015 13:56
Dictionary implementation
void Main()
{
var values = new List<string>();
var dict = new FancyDictionary<string, string>();
var insertWatch = new Stopwatch();
for(int i = 0; i < 3000; i++)
{
var entry = Guid.NewGuid().ToString();
values.Add(entry);