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
Remove trailing whitespace: | |
Pattern: [ \t]+(?=[\r\n]) | |
Replace: "" | |
Replace tabs with spaces: | |
Pattern: (?<=^([^\t\r\n]{4})*)\t | |
Replace: " " | |
Pattern: (?<=^([^\t\r\n]{4})*[^\t\r\n]{1})\t | |
Replace: " " | |
Pattern: (?<=^([^\t\r\n]{4})*[^\t\r\n]{2})\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
// Copyright (c) 2013, 2014 Masato Hagiwara | |
// https://github.com/mhagiwara/camxes.js | |
// Copyright (c) 2018 John Gietzen | |
// This source is subject to the MIT license. Please see license.md for more information. | |
// Originally from http://users.digitalkingdom.org/~rlpowell/hobbies/lojban/grammar/index.html | |
@using System.Linq; | |
@members | |
{ | |
private static string _join(IEnumerable<object> items) | |
{ |
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 Main() | |
{ | |
GetPassFailRateWithConfidence(10, 2, 0.95).ToString().Dump(); | |
GetPassFailRateWithConfidence(100, 20, 0.95).ToString().Dump(); | |
GetPassFailRateWithConfidence(1000, 200, 0.95).ToString().Dump(); | |
GetPassFailRateWithConfidence(10000, 2000, 0.95).ToString().Dump(); | |
} | |
public ErrorRate GetPassFailRateWithConfidence(long passes, long fails, double confidence) | |
{ |
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) { } | |
} |
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
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
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
// 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
<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
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: |