Skip to content

Instantly share code, notes, and snippets.

View fekberg's full-sized avatar

Filip Ekberg fekberg

View GitHub Profile
@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);
@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 / 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
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 / 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(() => { });
```
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 / 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:
@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:

(22:02:11) (frW) seesharp, var hexRepresentation = string.Join(" ", System.Text.Encoding.Default.GetBytes("me@home.com").Select(x => x.ToString("x").ToUpper())); return System.Text.Encoding.Default.GetBytes(hexRepresentation);
(22:02:13) (seesharp) byte[32] { 54, 68, 32, 54, 53, 32, 52, 48, 32, 54, 56, 32, 54, 70, 32, 54, 68, 32, 54, 53, 32, 50, 69, 32, 54, 51, 32, 54, 70, 32, 54, 68 }
(21:44:28) (frW) seesharp, Action f = null; f = () => { f(); f(); }; f(); return 1;
(21:44:32) (seesharp) timeout
@fekberg
fekberg / Listing 10.3.cs
Created September 17, 2012 19:16
Listing 10.3
var engine = new ScriptEngine();
var session = engine.CreateSession();
var result = session.Execute("var x = 10; x == 20");
Console.WriteLine(result);