This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Now | |
app.MapGet("/todos/{id}", async (int id, TodoDb db) => | |
await db.Todos.FindAsync(id) | |
is Todo todo | |
? Results.Ok(todo) | |
: Results.NotFound()) | |
.WithName("GetTodoById") | |
.Produces<Todo>(StatusCodes.Status200OK) | |
.Produces(StatusCodes.Status404NotFound); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ref: https://github.com/cston/csharplang/blob/DiscriminatedUnions/proposals/tagged-unions.md | |
using System.ComponentModel.DataAnnotations; | |
using Microsoft.EntityFrameworkCore; | |
using MiniValidation; | |
var builder = WebApplication.CreateBuilder(args); | |
var connectionString = builder.Configuration.GetConnectionString("TodoDb") ?? "Data Source=todos.db"; | |
builder.Services.AddSqlite<TodoDb>(connectionString); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ProgramFiles32() { | |
if ($null -ne ${env:ProgramFiles(x86)}) { | |
return ${env:ProgramFiles(x86)} | |
} | |
return $env:ProgramFiles | |
} | |
function Get-VsInstallLocation() { | |
$programFiles = Get-ProgramFiles32 | |
$vswhere = "$programFiles\Microsoft Visual Studio\Installer\vswhere.exe" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", | |
"blocks": [ | |
{ | |
"alignment": "left", | |
"segments": [ | |
{ | |
"foreground": "#f1184c", | |
"properties": { | |
"template": " \uf0e7 " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "text", // VS version | |
"style": "powerline", | |
"powerline_symbol": "\uE0C4", | |
"foreground": "#ffffff", | |
"background": "#5C2D91", // VS purple from https://visualstudio.microsoft.com/ | |
"properties": { | |
"prefix": "", | |
"text": "{{if .Env.VSCMD_VER}} {{.Env.VSCMD_VER}} {{end}}", | |
"postfix": "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Net.Http; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Hosting.Server; | |
using Microsoft.AspNetCore.Hosting.Server.Features; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Hosting; | |
using Microsoft.Extensions.Logging; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env dotnet run | |
var builder = WebApplication.CreateBuilder(args); | |
var config = builder.Configuration; | |
var connString = config["connectionString"] ?? "Data Source=todos.db"; | |
builder.AddDbContext<TodoDb>(options => options.UseSqlite(connString)); | |
builder.AddSqlite<Todo>(connString) // Higher level API perhaps? | |
var app = builder.Build(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2020-03-28 17:23:24,672 WARN 1 OutlookGoogleCalendarSync.OutlookOgcs.Calendar [0] - Sorry, something went wrong. You may want to try again. | |
2020-03-28 17:24:27,598 WARN 1 OutlookGoogleCalendarSync.Sync.PushSyncTimer [0] - Push Sync failed 3277 times to check for changed items. | |
2020-03-28 17:24:27,600 ERROR 1 OutlookGoogleCalendarSync.OGCSexception [0] - System.Runtime.InteropServices.COMException: Sorry, something went wrong. You may want to try again. | |
2020-03-28 17:24:27,601 ERROR 1 OutlookGoogleCalendarSync.OGCSexception [0] - Code: 0x85270057;-2061041577 | |
2020-03-28 17:24:55,940 WARN 1 OutlookGoogleCalendarSync.OutlookOgcs.Calendar [0] - Sorry, something went wrong. You may want to try again. | |
2020-03-28 17:24:59,851 WARN 1 OutlookGoogleCalendarSync.Sync.PushSyncTimer [0] - Push Sync failed 3278 times to check for changed items. | |
2020-03-28 17:24:59,851 ERROR 1 OutlookGoogleCalendarSync.OGCSexception [0] - System.Runtime.InteropServices.COMException: Sorry, something went wrong. You may want to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate root cert | |
$cert = New-SelfSignedCertificate -Type Custom -KeySpec Signature ` | |
-Subject "CN=AspNetCoreCertAuthRoot" -KeyExportPolicy Exportable ` | |
-HashAlgorithm sha256 -KeyLength 2048 ` | |
-CertStoreLocation "Cert:\CurrentUser\My" -KeyUsageProperty Sign -KeyUsage CertSign | |
# Make sure to trust this root cert | |
# Generate child cert with Client Authentication OID | |
New-SelfSignedCertificate -Type Custom -DnsName P2SChildCert -KeySpec Signature ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ASP.NET Core | |
# Build and test ASP.NET Core projects targeting .NET Core. | |
# Add steps that run tests, create a NuGet package, deploy, and more: | |
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core | |
trigger: | |
branches: | |
include: | |
- master | |
paths: |