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 / GitHubFlavoredMarkdown.md
Created February 1, 2024 20:29 — forked from Myndex/GitHubFlavoredMarkdown.md
GitHub Flavored Markdown Cheat Sheet
/// <binding BeforeBuild='default' />
"use strict";
var _ = require('lodash'),
gulp = require('gulp'),
uglify = require('gulp-uglify'),
cssmin = require('gulp-cssmin'),
rename = require('gulp-rename');

Upcoming

Date Event / Conference Talk / Presentation
-- TBD TBD

Past

| Date | Event / Conference | Talk / Presentation |

@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);
}
/*
Requests the navigator.mediaDevices for video input.
*/
export async function requestVideoDevices() {
try {
// Ask the first time to prime the underlying device list.
let devices = await navigator.mediaDevices.enumerateDevices();
if (devices &&
(devices.length === 0 || devices.every(d => d.deviceId === ""))) {
await navigator.mediaDevices.getUserMedia({

This is a sample app, trying to demonstrate the smallest ASP.NET Core Minimal API, a "Hello World!" example. The Program.cs* is only three lines of code.

Program.cs:

var app = WebApplication.CreateBuilder(args).Build();
app.MapGet("/", () => "Hello World!");
app.Run();
@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();
#nullable enable
using System;
using System.Net.Http;
using System.Net.Http.Json;
using System.Text.Json;
JsonSerializerOptions _options = new()
{
PropertyNameCaseInsensitive = true
@IEvangelist
IEvangelist / potential-worker-template.cs
Last active May 24, 2021 02:20
Potential worker service template improvements.
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Example.App;
using IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services => services.AddHostedService<Worker>())
.Build();
await host.RunAsync();
using System;
using System.Collections.Generic;
static IEnumerable<int> Fibonacci(int max)
{
int current = 1, next = 1;
while (current < max)
{
yield return current;
next = current + (current = next);