This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ObservableAPMExtensions | |
{ | |
public static IObservable<byte> ToObservable(this FileStream source) | |
{ | |
return source.ToObservable(4096, Scheduler.CurrentThread); | |
} | |
public static IObservable<byte> ToObservable(this FileStream source, int buffersize, IScheduler scheduler) | |
{ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var repo = new MyPermissionRepo(); | |
//These will all get batched up and sent together | |
repo.IsPermissioned("Marcus").Dump("Marcus"); | |
repo.IsPermissioned("Lee").Dump("Lee"); | |
repo.IsPermissioned("Merc").Dump("Merc"); | |
repo.IsPermissioned("Si").Dump("Si"); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
In conjunction with the patch for issue 72 | |
https://code.google.com/p/protobuf-net/issues/detail?id=72 | |
This file can make the current implementation of the Protobuf-net tools useful. Without these however protobuf-net is full of surprises like: | |
* Requiring you to specify if it should detect missing values (why is this not always on?) | |
* Not being able to identify between not specified (null in every other computer system) and the default value | |
* Not being able to compile if an Enum is optional but does not specify a default value?! | |
* Happily serializing invalid messages i.e. where required values are missing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Input; | |
using System.Windows.Media; | |
namespace MyLib | |
{ | |
//http://serialseb.blogspot.co.uk/2007/09/wpf-tips-6-preventing-scrollviewer-from.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace MyLib.Messaging | |
{ | |
public interface IConsumer<out T> | |
{ | |
///<summary>Allows non-destructive read access to the next message on the queue</summary> | |
T Peek(); | |
///<summary>Transactional consumer. Requires a transaction scope to be accessed.</summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using Cedar.EventStore.Streams; | |
namespace DunkyMoleFanClub | |
{ | |
public static class LeftFold | |
{ | |
public static readonly string DefaultKey = string.Empty; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace RxPerformanceTest.SerialDisposable.Console | |
{ | |
interface IRunnable | |
{ | |
ThroughputTestResult[] Run(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#From https://download.jetbrains.com/resharper/JetBrains.ReSharper.CommandLineTools.2016.2.20160913.100041.zip | |
$codeDupFolder = 'C:\Users\lee.campbell\Downloads\JetBrains.ReSharper.CommandLineTools.2016.2.20160913.100041\' | |
$codeDuplicateExe = $codeDupFolder + '\dupfinder.exe' | |
$codeDuplicateXsl = $codeDupFolder + '\dupFinder.xsl' | |
$xmlOutput = 'C:\Users\lee.campbell\Desktop\LoanServiceSlnDupes.xml' | |
$htmlOutput = 'C:\Users\lee.campbell\Desktop\LoanServiceSlnDupes.html' | |
.$codeDuplicateExe --show-text --output="$xmlOutput" -e="**/*.Designer.cs" -e="**/*.generated.cs" -e="**/*Test*/**/*.cs" -e="**/*Event.cs" 'C:\Source\GitHub\Mercury\src\Mercury.LoanService.sln' | |
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading; | |
using BenchmarkDotNet.Attributes; | |
public class IncrementBenchmarks | |
{ | |
private int _intValue; | |
private long _longValue; | |
[Setup] | |
public void Setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static partial class ObsEx | |
{ | |
public static IObservable<IList<T>> ThrottledBuffer<T>(this IObservable<T> source, TimeSpan period, IScheduler scheduler) | |
{ | |
return Observable.Create<IList<T>>(obs => | |
{ | |
var yieldTimer = new SerialDisposable(); | |
var buffer = new List<T>(); | |
Action yeildBuffer = () => { | |
//Not on same thread, so need to be careful here. |