Skip to content

Instantly share code, notes, and snippets.

View bymyslf's full-sized avatar

Luís Barbosa bymyslf

View GitHub Profile
@bymyslf
bymyslf / StreamAssert.cs
Created January 9, 2020 08:55
Compare streams
public static class StreamAssert
{
public static bool AreEquivalent<T>(T left, T right)
where T : Stream
{
int file1byte;
int file2byte;
if (left == right)
{
@bymyslf
bymyslf / TaskExtensions.cs
Last active February 21, 2021 14:51
Useful task extensions
namespace System.Threading.Tasks
{
using System;
using System.Runtime.CompilerServices;
using System.Threading;
/// <summary>
/// Extensions on Task and Task<T>.
/// </summary>
public static class TaskExtensions
@bymyslf
bymyslf / Either.cs
Created April 7, 2020 16:23
C# Either Monad
using System;
public class Either<TLeft, TRight>
{
private readonly TLeft left;
private readonly TRight right;
private readonly bool isLeft;
public Either(TLeft left)
{
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
public class SqlScriptMigrator
@bymyslf
bymyslf / IJobQueue.cs
Created April 9, 2021 13:09
Redis Job Queue
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
public interface IJobQueue
{
Task Finish(string key, CancellationToken cancellationToken = default);
Task Requeue(string key, CancellationToken cancellationToken = default);
@bymyslf
bymyslf / settings.json
Last active December 29, 2021 14:36
Windows Terminal Settings
// This file was initially generated by Windows Terminal 1.7.1091.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",