Skip to content

Instantly share code, notes, and snippets.

Avatar

Cameron MacFarland distantcam

View GitHub Profile
@distantcam
distantcam / SequentialWhenAll.cs
Last active Feb 3, 2016
An example using `Task.WhenAll` that runs all the tasks on the same thread.
View SequentialWhenAll.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
class Program
{
static void Main()
{
View Puzzle.cs
using System;
using System.Threading.Tasks;
class Program
{
static void Main()
{
Util.Method(() => ActionMethod());
Util.Method(ActionMethod); // Error CS0121 The call is ambiguous between the following methods or properties: 'Util.Method(Action)' and 'Util.Method(Func<Task>)'
}
@distantcam
distantcam / CUI.cs
Last active Feb 14, 2017
CUI - A simple Console UI
View CUI.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static System.Console;
using static System.ConsoleColor;
namespace CUI
{
public class ConsoleApplication<TScreen>
View PropertyChangedArgBenchmarks.cs
using System.ComponentModel;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Exporters;
using BenchmarkDotNet.Running;
[MemoryDiagnoser]
[MarkdownExporter]
public class PropertyChangedArgBenchmarks
{
@distantcam
distantcam / SimpleConfig.cs
Created Oct 12, 2017
Simple config class
View SimpleConfig.cs
public static class SimpleConfig
{
static string configFilePath;
public static void InitializeInLocalApplicationData(string name)
{
Initialize(Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
name,
"config.xml"
@distantcam
distantcam / Sample.csproj
Created Oct 19, 2017
Example new project
View Sample.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net462</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<DebugType>full</DebugType>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
@distantcam
distantcam / JobHelper.cs
Last active Jan 9, 2021
Unity Job system with async
View JobHelper.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Unity.Jobs;
public static class JobHelper
{
View CompositeParallelJobSystem.cs
using Unity.Entities;
using Unity.Jobs;
public abstract class CompositeParallelJobSystem<T1, T2> : JobComponentSystem
where T1 : struct, IJobParallelFor
where T2 : struct, IJobParallelFor
{
protected ComponentGroup group;
protected abstract ComponentGroup CreateGroup();
@distantcam
distantcam / extensions.json
Created Mar 28, 2019
Presentation settings for vscode
View extensions.json
{
"recommendations": [
"saviorisdead.theme-githubcleanwhite",
"evilz.vscode-reveal"
]
}
You can’t perform that action at this time.