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 int AskGunSkill(IIO io) | |
{ | |
io.Display("How good a shot are you with your rifle?"); | |
io.Display(" (1) Ace Marksman, (2) Good Shot, (3) Fair to Middlin'"); | |
io.Display(" (4) Need more practice, (5) Shaky Knees"); | |
io.Display("Enter one of the above . The better you claim you are, the"); | |
return io.InputValue("faster you'll have to be with your gun to be successful... ", 1, "Enter 1-5", 5, | |
"Enter 1-5"); | |
} |
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 UpdateFromText<T>(this T target, string changes, bool trueCase = true) | |
where T : class | |
{ | |
var propsTarget = target.GetType().GetProperties(); | |
var parts = changes.Split('='); | |
if (parts.Length != 2) | |
throw new ArgumentOutOfRangeException(parts[0], $"{parts[0]} is not a property of the target"); | |
var pT = propsTarget.FirstOrDefault(t => t.Name == parts[0]); | |
if (pT == 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
public static void UpdateFromText<T>(this T target, IDictionary<string, object> changes) | |
where T : class | |
{ | |
foreach (var kvp in changes) | |
{ | |
var propsTarget = typeof(T).GetProperty(kvp.Key, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); | |
if (propsTarget == null) | |
//throw new ArgumentOutOfRangeException(nameof(changes), $"{kvp.Key} is not a property of the target"); | |
continue; |
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 Update<T>(this T target, object changes) | |
where T : class | |
{ | |
var propsTarget = typeof(T).GetProperties(); | |
foreach (var pC in changes.GetType().GetProperties()) | |
{ | |
var pT = propsTarget.FirstOrDefault(t => t.Name == pC.Name); | |
if (pT == null) | |
throw new ArgumentOutOfRangeException(pC.Name, $"{pC.Name} is not a property of the target"); |
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 BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Running; | |
var summary = BenchmarkRunner.Run<ListResize>(); | |
public class ListResize | |
{ | |
static readonly int itemsToAdd = int.MaxValue / 100; | |
[Params(10, 20, 30, 40, 50, 60, 70, 80, 90, 100)] |
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
function global:prompt { | |
$Success = $? | |
Write-Host -Object $pwd -ForegroundColor Magenta | |
$date = Get-Date -Format "dd-MMM-yyyy HH:mm:ss" | |
Write-Host -Object $date -ForegroundColor Green | |
$quote = get-content "C:\Users\zames\OneDrive\Documents\times\$(Get-Date -Format "HH_mm").json" | ConvertFrom-Json | Get-random | |
Write-Host -Object $quote.Quote_first.Replace("<br>", "`n") -ForegroundColor Blue -NoNewLine | |
Write-Host -Object $quote.Quote_time_case -ForegroundColor Yellow -NoNewLine | |
Write-Host -Object $quote.Quote_last.Replace("<br>", "`n") -ForegroundColor Blue -NoNewLine |
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
{ | |
"Time": "00:01", | |
"Quote_first": "With the appointed execution time of ", | |
"Quote_time_case": "one minute past midnight", | |
"Quote_last": " just seconds away, I knocked on the metal door twice. The lock turned and the door swiftly swung open.", | |
"Title": "Death at Midnight", | |
"Author": "Donald A. Cabana", | |
"Sfw": "yes" | |
} |
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
function global:prompt { | |
$Success = $? | |
Write-Host -Object $pwd -ForegroundColor Magenta | |
$date = Get-Date -Format "dd-MMM-yyyy HH:mm:ss" | |
Write-Host -Object $date -ForegroundColor Green | |
return "> " | |
} |
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) 2019-2020 James M. Curran/Novel Theory LLC. All rights reserved. | |
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | |
using System; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
using System.Linq; | |
namespace NovelTheory.Common | |
{ |
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) 2019-2020 James M. Curran/Novel Theory LLC. All rights reserved. | |
// Licensed under the Apache License, Version 2.0. | |
// See License.txt in the project root for license information. | |
using System; | |
using System.Diagnostics; | |
using Microsoft.Extensions.Logging; | |
namespace NovelTheory.Common | |
{ |
NewerOlder