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 static class AnsiConsoleExtensions | |
{ | |
public static IAnsiConsole WriteJson(this IAnsiConsole console, JsonElement node, JsonStyle? jsonStyle = null) | |
{ | |
ArgumentNullException.ThrowIfNull(console); | |
ArgumentNullException.ThrowIfNull(node); | |
console.WriteJson(node, jsonStyle ?? JsonStyle.Default, 0); | |
return console; | |
} |
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
# How to fully uninstall Logitech G HUB on macOS via terminal/command line | |
# Tested on macOS version 12.3.1 (21E258) Monterey in April 2022 | |
# with Logitech G HUB version 2022.3.242300 (released on 2022-03-22) installed. | |
# 1. Make sure "Logitech G HUB" itself is not running. If it is, quit it. | |
# 2. Open "Activity Monitor" and force-quit all processes named "lghub*". | |
# 3. Delete system-wide files | |
sudo rm -rf /Applications/lghub.app |
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
A middleware to provide resolvers with their own, scoped instance, of a service. Example here is IMediator, but this could be made generic. |
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
/*Adrian Sullivan - 2019/11/15 Fun with polygons.*/ | |
/*Thanks to Michael J Swart for all the awesome work on color | |
https://michaeljswart.com/ | |
*/ | |
DECLARE @tt table(id int identity(0,1), label VARCHAR(50), gg GEOMETRY) | |
SET NOCOUNT ON | |
DECLARE @g geometry = 'POLYGON((-121.97087 37.372518,-121.97087 37.372518,-121.970863 37.372517,-121.970845 37.372515,-121.97087 37.372518))' |
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 FeatureViewLocationRazorViewEngine : RazorViewEngine | |
{ | |
public FeatureViewLocationRazorViewEngine() | |
{ | |
ViewLocationFormats = new[] | |
{ | |
"~/Features/{1}/{0}.cshtml", | |
"~/Features/{1}/{0}.vbhtml", | |
"~/Features/Shared/{0}.cshtml", | |
"~/Features/Shared/{0}.vbhtml", |
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.Collections.Generic; | |
using System.Linq; | |
using System.Web.Http; | |
using System.Data; | |
public class TodoApiController : ApiController | |
{ | |
private BetterMobileSpaContext db = new BetterMobileSpaContext(); | |
// GET /api/todoapi |
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 static void BulkInsert<T>(string connection, string tableName, IList<T> list) | |
{ | |
using (var bulkCopy = new SqlBulkCopy(connection)) | |
{ | |
bulkCopy.BatchSize = list.Count; | |
bulkCopy.DestinationTableName = tableName; | |
var table = new DataTable(); | |
var props = TypeDescriptor.GetProperties(typeof(T)) | |
//Dirty hack to make sure we only have system data types |