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
// usage: | |
// typeof(System.Collections.Generic.List<System.Double>).ToFullyQualifiedName() | |
// output: | |
// System.Collections.Generic.List<System.Double> | |
// | |
// usage: | |
// typeof(System.Collections.Generic.List<System.Double>).ToCSharpString( | |
// symbolDisplayFormat: new SymbolDisplayFormat( | |
// typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameOnly, | |
// genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters, |
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
// Reference here: https://www.youtube.com/watch?v=prURA1i8Qj4 | |
var rightMost = true; | |
var step = BigInteger.Zero; | |
var initialDepth = 5; | |
// Represents a simple tree (single trunk). Length is tree depth. Root node is excluded. Value is count of leaf nodes (heads) at that depth. | |
// Nodes will always be added to the right of the implied connections. |
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
// Set up Animations | |
var chain = new MarkovChain<string>(1); | |
chain.Add(new[] { "Sitting" }, "Sitting", 50); | |
chain.Add(new[] { "Sitting" }, "Grooming", 20); | |
chain.Add(new[] { "Sitting" }, "Sleeping", 20); | |
chain.Add(new[] { "Sitting" }, "Playing", 10); | |
chain.Add(new[] { "Playing" }, "Sitting", 100); | |
chain.Add(new[] { "Sleeping" }, "Sleeping", 60); |
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
You are now inhabiting my augmented reality headset. I may refer to you as "Computer" or "Headset" because of this. | |
I want you to help me control some software on my headset | |
From now on, I would like you to respond with code that contains your reponse, such as: | |
``` | |
response = "I understand."; | |
``` | |
If there is some some reason you want to issue a warning, you can first toggle the warning status with: |
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
<Query Kind="Program"> | |
<Reference><RuntimeDirectory>\System.Numerics.dll</Reference> | |
<Namespace>System.Drawing</Namespace> | |
<Namespace>System.Drawing.Drawing2D</Namespace> | |
<Namespace>System.Drawing.Text</Namespace> | |
<Namespace>System.Drawing.Imaging</Namespace> | |
<Namespace>System.Runtime.InteropServices</Namespace> | |
</Query> | |
const int FrameRate = 30; |
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
// Note: Much of the descriptions are from https://en.wikipedia.org/ | |
void Main() | |
{ | |
var sb = new StringBuilder(); | |
sb.AppendLine("digraph classes {"); | |
sb.AppendLine("node [shape=none width=0 height=0 margin=0];"); | |
Func<Type, string> id = null; | |
id = FuncUtils.Memoize((Type type) => |
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
Oh Yeaheyay! | |
[The Mystic Crystal] | |
Long ago and far away | |
In labarynths of coral caves | |
A Mystic Crystal was forged in glass | |
With magic or some shit like that. | |
Its powers had been used for good |
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
var rand = new Random(); | |
bool Play(ref int bank, int bet) | |
{ | |
var win = rand.Next(2) < 1; | |
checked | |
{ | |
bank += win ? bet : -bet; // If you win, you gain your bet back AND the winnings. If you lose, you just lose your bet. | |
} |
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
void Demo<T>(IEnumerable<IEnumerable<T>> ballots, int seats, IEqualityComparer<T> comparer = null) | |
{ | |
var elections = new Dictionary<string, Tuple<IElection<T>, ITieBreak<T>[]>> | |
{ | |
["STV"] = Tuple.Create<IElection<T>, ITieBreak<T>[]>( | |
new SingleTransferableVoteElection<T>(), | |
new ITieBreak<T>[] | |
{ | |
new BordaCountTieBreak<T>(), | |
new ApprovalCountTieBreak<T>(), |
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
// My opinions are my own. | |
public class PseudobicerosHancockanus : Flatworm { } | |
public abstract class Flatworm : Animal | |
{ | |
public Flatworm() : this(Sex.Male | Sex.Female) { } | |
public Flatworm(Sex sex) : base(sex) { } | |
} |
NewerOlder