Skip to content

Instantly share code, notes, and snippets.

View shawnwildermuth's full-sized avatar
:octocat:
Coding and Filming

Shawn Wildermuth shawnwildermuth

:octocat:
Coding and Filming
View GitHub Profile
@shawnwildermuth
shawnwildermuth / wildertheme.json
Last active October 18, 2021 12:24
My oh-my-posh Configuration
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [{
"type": "prompt",
"alignment": "left",
"segments": [{
"type": "root",
"style": "powerline",
"powerline_symbol": "\uE0B8",
"background": "#be8c00",
@shawnwildermuth
shawnwildermuth / program.cs
Created July 27, 2021 05:42
Using IActionResult in Minimal API
app.MapPost("/api/messenger", (Func<ContactModel, IMailService, IGoogleCaptchaService, string, Task<IActionResult>>)
(async ([FromBody] model, svc, captcha, template) =>
{
if (await captcha.Verify(model.Recaptcha))
{
if (await svc.SendMailAsync(template, model))
{
return new OkResult();
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="1password" version="7.9.822" />
<package id="7zip" version="19.0" />
<package id="7zip.install" version="19.0" />
<package id="adobe-creative-cloud" />
<package id="azure-functions-core-tools-3" version="3.0.3785" />
<package id="chocolatey" />
<package id="chocolateygui" />
<package id="curl" version="7.79.1" />
@shawnwildermuth
shawnwildermuth / Animal.cs
Created March 20, 2021 06:28
Tuples in C# Code
using System;
namespace TroubleWithTuples
{
public class Animal
{
public (string Name, int Age) GetInfo()
{
// return name and age
return ("Max", 16);
@shawnwildermuth
shawnwildermuth / program.cs
Created March 17, 2021 06:21
Top-Level Example for Cleaning Visual Studio projects
using System;
using System.IO;
using System.Linq;
using static System.Console;
WriteLine("VSCleaner...");
if (args.Length != 1)
{
WriteLine("You must supply a directory name.");
WriteLine("VSCleaner {DirectoryName}");
@echo off
echo Cleaning node_modules Directories
FOR /d /r . %%d IN (node_modules) DO (call :deleteDirs "%%d")
echo Cleaning bin Directories
FOR /d /r . %%d IN (bin) DO (call :deleteDirs "%%d")
echo Cleaning obj Directories
FOR /d /r . %%d IN (obj) DO (call :deleteDirs "%%d")
echo Cleaning .bak files
del /S *.bak
goto :eof
@shawnwildermuth
shawnwildermuth / program.cs
Created November 7, 2018 22:55
Configure EF logging in ASP.NET Core App.
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureLogging(ConfigLogging)
var result = someCollection
.Where(c => c.Married && c.Gender == Genders.Female)
.OrderBy(c => c.LastName)
.ForEach(c =>
{
c.LastName = $"{c.LastName}-{c.Partner.LastName}";
});
@shawnwildermuth
shawnwildermuth / VerifyFiles.ps1
Created June 8, 2018 22:56
Verify Files with Checksums and Powershell
param (
[string]$source = "d:\videoprojects\hwfilm\",
[string]$dest = "g:\hwfilm\",
[switch]$debug
)
$sourceFileList = Get-ChildItem -Path $source -Recurse | Sort-Object -Property FullName
write-host "Files = $($sourceFileList.Length)"
foreach ($file in $sourceFileList) {
$fullPath = $file.fullName.Substring($source.Length)
@shawnwildermuth
shawnwildermuth / SomeColl.cs
Created May 25, 2018 00:51
Badly formatted Collection that VS won't format.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SomeApp
{
public class SomeStaticCollection : List<Person>
{