Skip to content

Instantly share code, notes, and snippets.


Stephen Cleary StephenCleary

View GitHub Profile
StephenCleary / async.cs
Last active Feb 9, 2017 — forked from davidfowl/async.cs
Async quiz: How many threads are used? What does it print?
View async.cs
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
// The more evil version. :)
class Program
static void Main(string[] args)
View CustomerOrderDetailsViewModel.cs
internal class AwaitableMessages
public static Task<T> NextMessageAsync<T>()
var tcs = new TaskCompletionSource<T>();
Messenger.Default.Register<T>(null, item => tcs.TrySetResult(item));
return tcs.Task;
View Async
// I'm starting 10 calls at every 50 msec. Each call has a random execution time between 1-19 seconds.
// Many times the last answer comes from the 9th call instead of the 10th.
// I'm not sure I'm testing it properly.
void Main()
var rand = new Random();
StephenCleary / LinkedDic.cs
Last active Dec 31, 2015 — forked from ayende/LinkedDic.cs
Added tests with Builder, SortedImmutableDictionary, and LinkedDictionaryUnoptimized.
View LinkedDic.cs
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Voron.Util
public class LinkedDictionary<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>, IReadOnlyDictionary<TKey, TValue>
where TValue : class, new()
private readonly TValue _deleteMarker = new TValue();
StephenCleary / gist:6794708
Last active Dec 24, 2015 — forked from anonymous/gist:6782497
500 Internal Server Error for the request "" which is silently ignored by the JavaScript and results in no security questions in the dropdowns. Site has been down 34.5 hours and counting... The error message has been updated today with pre…
View gist:6794708
java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: Could not send Message.
You can’t perform that action at this time.