This document now exists on the official ASP.NET core docs page.
- Application
- Request Handling
using Spectre.Console; | |
using Spectre.Console.Rendering; | |
var renderable = new Markup("[yellow]H[/]ello [blue]W[/]orld"); | |
foreach (var segment in SplitSegments(renderable)) | |
{ | |
AnsiConsole.Write(new SegmentRenderable(segment)); | |
Thread.Sleep(Random.Shared.Next(100, 500)); | |
} |
This document now exists on the official ASP.NET core docs page.
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp2.2</TargetFramework> | |
<RootNamespace>EFCoreEnums</RootNamespace> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6" /> |
[{ | |
"question": "A flashing red traffic light signifies that a driver should do what?", | |
"A": "stop", | |
"B": "speed up", | |
"C": "proceed with caution", | |
"D": "honk the horn", | |
"answer": "A" | |
}, { | |
"question": "A knish is traditionally stuffed with what filling?", | |
"A": "potato", |
using System; | |
using System.Numerics; | |
namespace Common | |
{ | |
/// <summary> | |
/// Arbitrary precision decimal. | |
/// All operations are exact, except for division. Division never determines more digits than the given precision. | |
/// Source: https://gist.github.com/JcBernack/0b4eef59ca97ee931a2f45542b9ff06d | |
/// Based on https://stackoverflow.com/a/4524254 |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Text; | |
using System.Threading.Tasks; | |
/// <summary> | |
/// An async alternative to System.IO.File common usages | |
/// </summary> | |
public static class FileAsync |
Update 2022: git checkout -p <other-branch>
is basically a shortcut for all this.
FYI This was written in 2010, though I guess people still find it useful at least as of 2021. I haven't had to do it ever again, so if it goes out of date I probably won't know.
Example: You have a branch refactor
that is quite different from master
. You can't merge all of the
commits, or even every hunk in any single commit or master will break, but you have made a lot of
improvements there that you would like to bring over to master.
Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.