Skip to content

Instantly share code, notes, and snippets.

View edamtoft's full-sized avatar

Eric Damtoft edamtoft

View GitHub Profile
@edamtoft
edamtoft / keybase.md
Created November 20, 2018 18:08
Keybase Verification

Keybase proof

I hereby claim:

  • I am edamtoft on github.
  • I am edamtoft (https://keybase.io/edamtoft) on keybase.
  • I have a public key ASAW4K_70VpLoPo8TegJ_4-8BBhrH2FxGKoSBEO0cqVYogo

To claim this, I am signing this object:

@edamtoft
edamtoft / RateLimitingOptions.cs
Last active November 13, 2018 16:43
Rate Limiting with C# and Redis
public sealed class RateLimitingOptions
{
public int Attempts { get; set; }
public int Seconds { get; set; }
public int RedisDb { get; set; }
}
@edamtoft
edamtoft / DomainObject.cs
Last active October 24, 2018 21:54
A barebones domain object in C# that wraps a string. Can be converted to and from a string and serialized.
[TypeConverter(typeof(Converter))]
public readonly struct DomainObject : IEquatable<DomainObject>, IEquatable<string>
{
public readonly string _value;
public DomainObject(string value) => _value = value ?? throw new ArgumentNullException(nameof(value));
public bool Equals(DomainObject other) => StringComparer.OrdinalIgnoreCase.Equals(_value, other._value);
public bool Equals(string other) => StringComparer.OrdinalIgnoreCase.Equals(_value, other);