stateDiagram-v2
%% https://en.wikipedia.org/wiki/.NET_Framework_version_history
%% https://en.wikipedia.org/wiki/.NET#History
%% TFMs https://learn.microsoft.com/en-us/dotnet/standard/frameworks
net40: 4.0
net45: 4.5
net48: 4.8
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
| /* A script to scrape the Rolling Stone Greatest Science Fiction Movies of All Time article | |
| at https://www.rollingstone.com/tv-movies/tv-movie-lists/best-sci-fi-movies-1234893930/ | |
| Paste into browser and hit enter to avoid all the scrolling they want you to do. | |
| You'll have to click 'Load More' a couple times the bottom to get all of them. | |
| Results are below the code. */ | |
| const films = []; | |
| const stripFancyQuotes = (str) => { | |
| // values look like: '‘Westworld’ (1973)' | |
| return str.replace(/‘|’/g, ''); |
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.Linq; | |
| namespace System.Collections.Generic; | |
| public static class List | |
| { | |
| public static List<T> From<T>(T value) => new(1) { value }; | |
| public static List<T> From<T>(params T[] values) => values.ToList(); | |
| } |
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
| // https://andrewlock.net/creating-strongly-typed-xunit-theory-test-data-with-theorydata/ | |
| public class CalculatorTestData : TheoryData<int, int, int> | |
| { | |
| public CalculatorTestData() | |
| { | |
| Add(1, 2, 3); | |
| Add(-4, -6, -10); | |
| Add(-2, 2, 0); | |
| Add(int.MinValue, -1, int.MaxValue); | |
| Add(1.5, 2.3m, "The value"); // will not compile! |
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.IO; | |
| using System.Reflection; | |
| public static class EmbeddedResources | |
| { | |
| public static string Read(string resourceName) | |
| { | |
| var assembly = Assembly.GetExecutingAssembly(); | |
| var defaultNamespace = assembly.GetName().Name; |
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
| <?xml version="1.0" encoding="utf-8" ?> | |
| <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
| <CodeSnippet Format="1.0.0"> | |
| <Header> | |
| <Title>parens</Title> | |
| <Shortcut>parens</Shortcut> | |
| <Description>Code snippet to surround a block of code with parentheses</Description> | |
| <Author>Dan Lumpp</Author> | |
| <SnippetTypes> | |
| <SnippetType>Expansion</SnippetType> |
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 interface IIndexAccessible<TKey, TValue> | |
| { | |
| TValue this[TKey index] { get; } | |
| } |
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
| # Moves only files matching any wildcard in the array | |
| # PowerShell has a bug that throws errors for each non-matching file | |
| # but it still works and moves the matches | |
| # https://github.com/PowerShell/PowerShell/issues/2385 | |
| $filters = @("*.pdf", "*.jpg") | |
| # alternatively read in filters from a text file, separated by newlines | |
| # $filterFile = "C:\filters.txt" | |
| # $filters = Get-Content -Path $filterFile |
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
| Write-Host ( Get-ChildItem C:\somefolder | Measure-Object ).Count |
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.Diagnostics; | |
| namespace Diagnostics | |
| { | |
| public class ExecutionTimer : IDisposable | |
| { | |
| private Stopwatch stopwatch; | |
| private string name; | |
| private Action<string> outputAction; |
NewerOlder