This file contains 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 class DataTableSearch | |
{ | |
public string? Value | |
{ | |
get; set; | |
} | |
public bool Regex | |
{ | |
get; set; | |
} |
This file contains 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
//Copyright (C) Microsoft Corporation. All rights reserved. | |
//https://learn.microsoft.com/en-us/previous-versions/bb894665(v=msdn.10)?redirectedfrom=MSDN | |
//https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library | |
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Reflection; |
This file contains 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
/// <summary> | |
/// Wires up everything needed for dependency injection in mvc controllers. | |
/// Ripped from SO: https://stackoverflow.com/a/68873916 | |
/// </summary> | |
public class DependencyInjectionConfig | |
{ | |
public static void Configure(ControllerBuilder controllerBuilder) | |
{ | |
var services = new ServiceCollection(); |
This file contains 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 MinimalApi, Htmx Demo | |
Notes: | |
* only tested with .NET 8 RC2 | |
* don't do something like this in production, this is just a dumbed down example of how to use Htmx with ASP.NET | |
1) Create a new web api project: | |
dotnet new webapi --no-https -n HtmxMinApiDemo | |
2) Replace the entire contents of the generated Program.cs file with all of this content |
This file contains 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
/* | |
* Arguments class: application arguments interpreter | |
* | |
* Authors: R. LOPES | |
* Contributors: R. LOPES | |
* Created: 25 October 2002 | |
* Modified: 28 October 2002 | |
* | |
* Version: 1.0 | |
*/ |
This file contains 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
async Task Main() | |
{ | |
var builder = WebApplication.CreateBuilder(); | |
builder.Services.AddEndpointsApiExplorer(); | |
builder.Services.AddSwaggerGen(s => s.SwaggerDoc("v1", new OpenApiInfo | |
{ | |
Title = "Report API", | |
Description = "Manager all of your reporting needs.", | |
Version = "v1", | |
TermsOfService = null, |
This file contains 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
/// <summary> | |
/// Helper for working with calendar concepts. | |
/// </summary> | |
public static class CalendarHelper | |
{ | |
/// <summary> | |
/// Returns all of the weeks for specified calendar month. | |
/// </summary> | |
public static IEnumerable<Week> GetWeeksForCalendarMonth(DateOnly month) | |
{ |
This file contains 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.IO; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
// https://www.pinvoke.net/default.aspx/shlwapi.assocquerystring | |
// https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-assocquerystringa | |
// https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-findexecutablea | |
// https://stackoverflow.com/a/9540278 |
This file contains 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.Runtime.CompilerServices; | |
// Ripped from S.O. answer: https://stackoverflow.com/a/66285728/1594171 | |
// 1. Put this code in ProjectSourcePath.cs at root of project | |
// 2. Reference project path like this: ProjectSourcePath.Value | |
internal static class ProjectSourcePath | |
{ | |
private const string myRelativePath = nameof(ProjectSourcePath) + ".cs"; | |
private static string? lazyValue; | |
public static string Value => lazyValue ??= CalculatePath(); |
This file contains 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 class GenericComparer<T> : IComparer<T> | |
{ | |
private readonly Func<T, IComparable> _comparer; | |
private GenericComparer(Func<T, IComparable> comparer) | |
{ | |
_comparer = comparer ?? throw new ArgumentNullException(nameof(comparer)); | |
} | |
public static GenericComparer<T> Create(Func<T, IComparable> comparer) |
NewerOlder