Skip to content

Instantly share code, notes, and snippets.

View IEvangelist's full-sized avatar
:octocat:
Coding for a better world 🤓

David Pine IEvangelist

:octocat:
Coding for a better world 🤓
View GitHub Profile
@IEvangelist
IEvangelist / IDistributedCache.cs
Last active April 29, 2023 00:23
Proposed new APIs for the `IDistributedCache` interface.
public interface IDistributedCache
{
T? GetOrCreate(string key, Func<DistributedCacheEntryOptions, T> factory)
{
var bytes = Get(key);
if (bytes is { Length: > 0 })
{
var payload = Encoding.UTF8.GetString(bytes);
return JsonSerializer.Deserialize<T>(payload);
}
@davidfowl
davidfowl / MinimalAPIs.md
Last active May 1, 2024 20:58
Minimal APIs at a glance
@IEvangelist
IEvangelist / Program.cs
Last active December 2, 2021 06:32
Minimal API — Azure Cosmos DB repository-pattern .NET SDK
// GitHub: 👨🏽‍💻 https://github.com/ievangelist
// Twitter: 🤓 https://twitter.com/davidpine7
// SDK: 🛠️ https://github.com/IEvangelist/azure-cosmos-dotnet-repository
using System.ComponentModel.DataAnnotations;
using Microsoft.Azure.CosmosRepository;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddCosmosRepository();
@NickCraver
NickCraver / BotLovin.cs
Last active January 5, 2023 11:36
Some bot/crawler fun on Stack Overflow. 10 hours of fun, to be precise.
private static readonly string[] tenHoursOfFun =
{
"https://www.youtube.com/watch?v=wbby9coDRCk",
"https://www.youtube.com/watch?v=nb2evY0kmpQ",
"https://www.youtube.com/watch?v=eh7lp9umG2I",
"https://www.youtube.com/watch?v=z9Uz1icjwrM",
"https://www.youtube.com/watch?v=Sagg08DrO5U",
"https://www.youtube.com/watch?v=5XmjJvJTyx0",
"https://www.youtube.com/watch?v=IkdmOVejUlI",
"https://www.youtube.com/watch?v=jScuYd3_xdQ",
@davidfowl
davidfowl / dotnetlayout.md
Last active May 3, 2024 08:40
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/