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.Text; | |
| using System.Text.Json; | |
| using Microsoft.AspNetCore.Mvc.Infrastructure; | |
| namespace Demo.Middleware; | |
| public class HostDebuggerOptions | |
| { | |
| public string RouteDebuggerPath { get; set; } = "/route-debugger"; |
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
| public static class Program | |
| { | |
| public static int Main(string[] args) | |
| { | |
| // azure home directory | |
| var homeDirectory = Environment.GetEnvironmentVariable("HOME") ?? "."; | |
| Log.Logger = new LoggerConfiguration() | |
| .MinimumLevel.Verbose() | |
| .MinimumLevel.Override("Microsoft", LogEventLevel.Information) |
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
| public readonly struct ConcurrencyToken : IEquatable<ConcurrencyToken> | |
| { | |
| public static readonly ConcurrencyToken None = new(Array.Empty<byte>()); | |
| public byte[] Value { get; } | |
| public ConcurrencyToken(byte[] value) | |
| { | |
| Value = value ?? Array.Empty<byte>(); | |
| } |
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
| [MemoryDiagnoser] | |
| public class BenchmarkSwitch | |
| { | |
| [Params(typeof(int), typeof(DateTimeOffset), typeof(TimeSpan))] | |
| public Type TargetType { get; set; } = typeof(int); | |
| [Benchmark(Baseline = true)] | |
| public int BaseLineBenchmark() | |
| { | |
| if (TargetType == typeof(string)) |
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
| ([\w._]+)\.Should\(\)\.NotBeNull\(\) | |
| Assert.NotNull($1) | |
| ([\w._]+)\.Should\(\)\.NotBeEmpty\(\) | |
| Assert.NotEmpty($1) | |
| ([\w.!_]+)\.Should\(\)\.Be\(([\w.!_" ]+)\) | |
| Assert.Equal($2, $1) | |
| ([\w._]+)\.Should\(\)\.BeTrue\(\) |
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
| DECLARE @name NVARCHAR(256) | |
| DECLARE @path NVARCHAR(512) | |
| DECLARE @fileName NVARCHAR(512) | |
| DECLARE @fileDate NVARCHAR(40) | |
| -- specify database backup directory | |
| SET @path = 'D:\Backup\Database\' | |
| -- specify filename format | |
| SELECT @fileDate = CONVERT(NVARCHAR(20),GETDATE(),112) |
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
| CREATE FUNCTION [dbo].[GenerateULID] | |
| ( | |
| @random AS BINARY(10), | |
| @timestamp AS DATETIME2 = NULL | |
| ) | |
| RETURNS VARCHAR(26) | |
| AS | |
| BEGIN | |
| -- Crockford's base32 alphabet | |
| DECLARE @alphabet VARCHAR(32) = '0123456789ABCDEFGHJKMNPQRSTVWXYZ' |
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
| // Smooth scrolling for hash links | |
| function hashLinkScrolling() { | |
| // Get all links that start with # | |
| const hashLinks = document.querySelectorAll('a[href^="#"]'); | |
| hashLinks.forEach(link => { | |
| link.addEventListener('click', function(e) { | |
| // Prevent default anchor behavior | |
| e.preventDefault(); |
OlderNewer