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
/*
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({
@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);
}
@IEvangelist
IEvangelist / GitHubFlavoredMarkdown.md
Created February 1, 2024 20:29 — forked from Myndex/GitHubFlavoredMarkdown.md
GitHub Flavored Markdown Cheat Sheet
internal static class HttpClientExtensions
{
internal static async Task GetAsync(
this HttpClient client,
string requestUri,
Stream destination,
IProgress<float> progress,
CancellationToken cancellationToken = default)
{
using HttpResponseMessage response = await client.GetAsync(
@IEvangelist
IEvangelist / dotnet-brand-colors.css
Created April 30, 2025 15:56
.NET Brand Colors—CSS
:root {
/* Common brand colors */
--brand-blue: #512BD4;
--brand-purple: #512BD4;
--magenta: #D600AA;
--cyan: #28C2D1;
--yellow: #F7B548;
--flamingo: #F65163;
}