public void MapUserWithStaticMapper2()
{
var users = new[]
{
new User(1, "Bob Almighty", "Green", DateTimeOffset.Now),
new User(2, "Alice Wunder", "Orange", DateTimeOffset.Now)
};
var view = users.Select(u => UserSummary.MapFrom(u));
This file contains 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 DapperExtensions | |
{ | |
private static readonly IEnumerable<TimeSpan> RetryTimes = new[] | |
{ | |
TimeSpan.FromSeconds(1), | |
TimeSpan.FromSeconds(2), | |
TimeSpan.FromSeconds(3) | |
}; | |
private static readonly AsyncRetryPolicy RetryPolicy = Policy |
This file contains 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
var transientErrors = new HashSet<WebExceptionStatus>(new[] | |
{ | |
WebExceptionStatus.ConnectFailure, | |
WebExceptionStatus.ConnectionClosed, | |
WebExceptionStatus.KeepAliveFailure, | |
WebExceptionStatus.Pending, | |
WebExceptionStatus.PipelineFailure, | |
WebExceptionStatus.ProtocolError, | |
WebExceptionStatus.ReceiveFailure, | |
WebExceptionStatus.RequestCanceled, |
This file contains 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
go to docker.com and create an account. download the appropriate docker desktop installer for your computer and install | |
Then you will need to create a file called docker-compose.yml in some directory on your hard drive |
This file contains 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 System.Diagnostics; | |
int x = 10; | |
int y = 20; | |
var tmp = x; | |
x = y; | |
y = tmp; | |
Debug.Assert(x == 20); |
This file contains 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 SixLabors.ImageSharp; | |
using SixLabors.ImageSharp.Drawing; | |
using SixLabors.ImageSharp.Drawing.Processing; | |
using SixLabors.ImageSharp.PixelFormats; | |
using SixLabors.ImageSharp.Processing; | |
var destWidth = 1920; | |
var destHeight = 1080; | |
using var image = new Image<Rgba32>(destWidth, destHeight); |
This file contains 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 System.Numerics; | |
namespace nlc; | |
public class LineCounter | |
{ | |
public const int BufferSize = 128 * 1024; | |
private const byte rune = (byte)'\n'; | |
private static readonly Vector<byte> mask = new(rune); |
This file contains 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
record Pan(string Style, decimal Price, string ProductUrl, string ThumbnailUrl) | |
{ | |
public XElement ToRss(XNamespace mediaNs) | |
{ | |
return new XElement("item", | |
new XElement("title", Style), | |
new XElement("description", $"Buy now for {Price}"), | |
new XElement("link", ProductUrl), | |
new XElement(mediaNs + "thumbnail", new XAttribute("url", ThumbnailUrl)) | |
); |
This file contains 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
import the following nuget package: | |
> Install-Package SixLabors.ImageSharp.Drawing -Version 1.0.0-beta11 |
This file contains 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
[AttributeUsage(System.AttributeTargets.All, AllowMultiple = true, Inherited = true)] | |
public class ಠ_ಠAttribute : Attribute | |
{ | |
public ILog Log { get; set; } | |
public ಠ_ಠAttribute() | |
{ | |
Log.Info("This code is bad and you should feel bad"); | |
} | |
} |
NewerOlder