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 messageCount = 10000; | |
var sum =0L; | |
var result = ThroughputTestResult.Capture(messageCount, () => sum = SumOfSquares(messageCount)); | |
Console.WriteLine($"Result: SumOfSquares({messageCount}) = {sum}"); | |
Console.WriteLine(result.ToString()); | |
} |
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() | |
{ | |
//Generates the .gv file content that can be put into GraphViz to vizualize your dependency tree. | |
// Once in GrpahViz, export to svg to avoid guessing how big you will need it (e.g. compared to PNG/JPG or other raster formats) | |
var rootPath = @"C:\source\GitHub\Mercury"; | |
var outputPath = @"C:\source\GitHub\Mercury\references.dot"; | |
var limit = 1000; | |
var projects = Directory.GetFiles(rootPath, "*.csproj", SearchOption.AllDirectories) | |
.Where(path=>!path.ToLowerInvariant().Contains("test")) //Exclude tests for sanity |
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
#Installs SQL Server locally with standard settings for Developers/Testers. | |
# Install SQL from command line help - https://msdn.microsoft.com/en-us/library/ms144259.aspx | |
$sw = [Diagnostics.Stopwatch]::StartNew() | |
$currentUserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name; | |
$SqlServerIsoImagePath = "???\Downloads\Microsoft\SQL Server 2016 Developer Edition\en_sql_server_2016_developer_x64_dvd_8777069.iso" | |
#Mount the installation media, and change to the mounted Drive. | |
$mountVolume = Mount-DiskImage -ImagePath $SqlServerIsoImagePath -PassThru | |
$driveLetter = ($mountVolume | Get-Volume).DriveLetter | |
$drivePath = $driveLetter + ":" |
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.Diagnostics; | |
using System.Reactive.Disposables; | |
using System.Reactive.Linq; | |
using System.Reactive.Concurrency; | |
using Microsoft.Practices.Prism.Logging; | |
using log4net; | |
using log4net.Core; | |
//From ResSharper --> Options --> Code Inspection --> Code Annotations -->Copy default implementation to clipboard |
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() | |
{ | |
//I want to have it format like: | |
//------------------------------- | |
// Given a new strategy | |
// When the name is modified | |
// Then raise property changed | |
// When trade added | |
// The DeltaCashSum equals Trade DeltaCash | |
// When invalid trade added |
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.Collections.ObjectModel; | |
using System.Collections.Specialized; | |
using System.ComponentModel; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
//TODO: Allow the ability to provide multiple properties to WhenPropertyChanges |
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
//2012.06.07 fixed scoping of GUID | |
//2012.05.29 for use with kdb+v3.0, changed handshake and added Guid. boolean v6->vt tracks type capability. | |
//2012.01.26 refactored clamp into clampDT, for Date.DateTime() | |
//2012.01.25 rz() clamp datetime to valid range | |
//2010.11.17 Block sending new timetypes to version of kdb+ prior to v2.6 (use prior release of KdbClient.cs for older kdb+ versions) | |
// Max buffer size (default 64kB) used for reading is now a parameter to the KdbClient constructor | |
// Date, Month, Minute, Second, KTimeSpan are now serializable, implement IComparable | |
// and have default constructors for xml serialization. | |
// Added GetNullRepresentation(Type t) | |
//2010.08.05 Added KException for exceptions due to server error, authentication fail and func decode |
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. |
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
#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; |
NewerOlder