Skip to content

Instantly share code, notes, and snippets.

View RickStrahl's full-sized avatar

Rick Strahl RickStrahl

View GitHub Profile
@RickStrahl
RickStrahl / VoiceDictation.cs
Last active March 30, 2025 18:46
Windows Media Speech Recognition/Dictation
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Windows.Media.SpeechRecognition;
using System.Windows.Controls;
using System.Windows.Input;
using Westwind.Utilities;
using MarkdownMonster.Windows;
using Windows.Globalization;
@RickStrahl
RickStrahl / PackageLoader.cs
Last active March 18, 2025 23:41
A first-cut NuGet Package Loader
// Paste into LinqPad
// dotnet add package NuGet.Protocol
async Task Main()
{
// package sources
string[] sources = ["/projects/Nuget", "https://api.nuget.org/v3/index.json"];
// Package loader: specify output folder for package assemblies
var pack = new NuGetPackageLoader(@"d:\temp\Packages");
await pack.LoadPackageAsync("Westwind.Ai", "0.2.4.2", sources);
@RickStrahl
RickStrahl / HeapTest.prg
Last active January 14, 2025 23:43
Demonstrate FoxPro slow Method call vs direct call.
CLEAR
SET PROCEDURE TO wwapi ADDITIVE && or whereever wwHeap lives
LOCAL loHeap as wwHeap
loHeap = CREATEOBJECT("wwHeap")
lnIterations = 10000000 && 10 million characters
lcData = REPLICATE("0123456789",lnIterations / 10)
loHeap.SetData(lcData)
@RickStrahl
RickStrahl / TcpIp-WebSer-AppSpecific.cs
Created November 28, 2023 08:35
A minimal, app-specific TCP/IP Web Server using .NET Code. Very simplistic manual request parsing and 'routing' for a few simple operations against the server.
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using MarkdownMonster.Controls;
@RickStrahl
RickStrahl / isWebViewVersionInstalledUi.cs
Created November 9, 2023 22:07
Interactive UI version of whether WebView is installed and then launching installer with Admin Rights
/// <summary>
/// Helper function that checks to see if the WebView control is installed
/// and if not prompts to install it.
///
/// Should be called during app startup to ensure the WebView Runtime is available.
/// </summary>
/// <param name="showDownloadUi"></param>
/// <returns></returns>
public static bool IsWebViewVersionInstalledUi(bool showDownloadUi = false)
{
@RickStrahl
RickStrahl / Fallbacks-log.txt
Created September 26, 2023 20:17
Fallback for app launching net7.0-windows with <RollForward>LatestMajor</RollForward> with net8.0 RC installed.
This file has been truncated, but you can view the full file.
Tracing enabled @ Tue Sep 26 20:10:54 2023 GMT
--- Invoked dotnet [version: 8.0.0-preview.7.23375.6, commit hash: 65b696cf5e7599ad68107138a1acb643d1cedd9d] main = {
C:\Program Files\dotnet\dotnet.exe
MarkdownMonster.dll
--roll-forward
LatestMajor
--roll-forward-to-prerelease
1
}
@RickStrahl
RickStrahl / Markdig-MediaLinks-LocalFiles-Bug.cs
Created June 13, 2023 00:46
Demonstrates that Markdig Media links are not working when using relative links - appears they only work with http urls
@RickStrahl
RickStrahl / CreateGistFile.cs
Last active February 14, 2022 22:41
CreateGistFile
public static JObject CreateGistPostJson(GistItem gist)
{
dynamic obj = new JObject();
obj.Add("description", new JValue(gist.description));
obj.Add("public", gist.isPublic);
obj.Add("files", new JObject());
obj.files.Add(gist.filename, new JObject());
@RickStrahl
RickStrahl / SimpleHttpServer.cs
Created January 11, 2022 23:35
A simple .NET HttpListener implementation of a basic static Web Server on Windows
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Sockets;
using System.Net;
using System.IO;
using System.Threading;
namespace Westwind.Http.Server
{
@RickStrahl
RickStrahl / ApplicationInsightsUIIssues.md
Last active November 14, 2021 20:58
Application Insights Query Portal Issues

For ApplicationInsights in particular the UI is absolutely, horrendously terrible. I'm not a fan of Azure portal in general, but the ApplicationInsights portal in particular has a ton of UI issues that are not just cosmetic but functionally broken.

  • Startup shows a getting started video even on direct links to my query list or a specific query.

  • Can't jump directly to a query - always extra steps.

  • Creation of queries in the UI is confusing as hell
    Edit and Save are conflated in meaning. Save creates a new Snippet? WTF? But Ctrl-S saves? WTF?