Skip to content

Instantly share code, notes, and snippets.

View dtaylor-530's full-sized avatar

dtaylor-530

View GitHub Profile
@dtaylor-530
dtaylor-530 / gist:442b4ca4f8a92b513b29c47affda38a9
Last active May 9, 2018 12:04
Kaos Combinatorics Extensions
/// <summary>
/// rearranges the elements into a sequence of element sets where no set has the same elements as another
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="c"></param>
/// <param name="size"></param>
/// <returns></returns>
public static IEnumerable<IEnumerable<T>> CombineDistinct<T>(this IEnumerable<T> c, int size)
{
return c.ReArrange(new Kaos.Combinatorics.Combination(c.Count(), size).EnumerateDistinct());
@dtaylor-530
dtaylor-530 / gist:c1236e1648ca6a577c17611080304817
Created April 17, 2020 08:37
Multi-line Tracker for OxyPlot
#nullable enable
using OxyPlot;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using OxyPlot.Series;
namespace OxyPlotEx
appSettings vs. applicationSettings in C#
https://bauermalzwei.de/2019/01/03/appsettings-vs-applicationsettings-in-c/
@dtaylor-530
dtaylor-530 / gist:4485d290d994dd97b3bcf8bae51782de
Last active October 19, 2022 13:02
switching to UI thread
public async void btnStart_Click(object sender, RoutedEventArgs e)
{
var syncContext = SynchronizationContext.Current;
lblStatus.Text = "Working...";
// non blocking call
var data = await GetDataFromRemoteServerAsync().ConfigureAwait(false);
// blocking call, but runs on a worker thread
DoSomeCpuBoundWorkWithTheData(data);