This file contains hidden or 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
<?xml version="1.0" encoding="utf-8" ?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>propg</Title> | |
<Shortcut>propg</Shortcut> | |
<Description>Code snippet for an automatically implemented getter-only property</Description> | |
<Author>Bruno Zell</Author> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8" ?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>propr</Title> | |
<Shortcut>propr</Shortcut> | |
<Description>Code snippet for an expression bodied property</Description> | |
<Author>Bruno Zell</Author> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> |
This file contains hidden or 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 sealed class AsyncQueue<T> : IAsyncEnumerable<T>, IDisposable | |
{ | |
private readonly SemaphoreSlim _enumerationSemaphore = new SemaphoreSlim(1); | |
private readonly BufferBlock<T> _bufferBlock = new BufferBlock<T>(); | |
public void Enqueue(T item) => | |
_bufferBlock.Post(item); | |
public int CurrentCount => | |
_bufferBlock.Count; |
This file contains hidden or 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 sealed class AsyncEvent | |
{ | |
/// <summary> | |
/// The object used for synchronization. | |
/// </summary> | |
private readonly object _mutex = new object(); | |
/// <summary> | |
/// The current task to await the next raise of the event. | |
/// </summary> |
This file contains hidden or 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 class LookupJsonConverter : JsonConverter | |
{ | |
public override bool CanConvert(Type objectType) => | |
objectType.GetInterfaces() | |
.Any(a => a.IsGenericType && a.GetGenericTypeDefinition() == typeof(ILookup<,>)); | |
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) => | |
throw new NotImplementedException(); | |
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) |
This file contains hidden or 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
<ItemGroup> | |
<CopyAlways Include="appsettings.json" /> | |
<CopyAlways Include="appsettings.*.json" /> | |
<None Update="@(CopyAlways)"> | |
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |
</None> | |
</ItemGroup> |
This file contains hidden or 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 abstract class HostedService : IHostedService { | |
// Code kindly provided by David Fowler: https://gist.github.com/davidfowl/a7dd5064d9dcf35b6eae1a7953d615e3 | |
private Task _executingTask; | |
private CancellationTokenSource _cts; | |
public Task StartAsync(CancellationToken cancellationToken) | |
{ | |
// Create a linked token so we can trigger cancellation outside of this token's cancellation | |
_cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); |
This file contains hidden or 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
# Version: 1.3.2 (Using https://semver.org/) | |
# Updated: 2019-08-04 | |
# See https://github.com/RehanSaeed/EditorConfig/releases for release notes. | |
# See https://github.com/RehanSaeed/EditorConfig for updates to this file. | |
# See http://EditorConfig.org for more information about .editorconfig files. | |
########################################## | |
# Common Settings | |
########################################## |
This file contains hidden or 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 DateTimeExtensions { | |
public static DateTime AsUnixTimeMiliseconds(this long miliseconds) => | |
new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc) | |
.AddMilliseconds(miliseconds); | |
public static DateTime AsUnixTimeMiliseconds(this long seconds) => | |
new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc) | |
.AddSeconds(seconds); | |
public static decimal ToUnixTimestamp(this DateTime dateTime) => |
This file contains hidden or 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 Typewriter.Extensions; | |
Template(Settings settings) { | |
settings.IncludeProject("Template.Core"); | |
settings.OutputFilenameFactory = f => "urls-gen.ts"; | |
} | |
string GetRoute(Constant constant) { |
NewerOlder