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
<script> | |
// loop over all "up-down" elements | |
for(let ud of document.querySelectorAll('span[id$=ud]')) | |
{ | |
// reflect that it is already expanded | |
ud.className = 'arrow-up'; | |
// derive the expandable element's id | |
let id = ud.id.substring(0, ud.id.length - 2); |
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
var ch = Channel.CreateUnbounded<int>(); | |
var producer = Task.Run(() => | |
{ | |
for (int i = 0; i < 500_000; i++) | |
ch.Writer.WriteAsync(i); | |
ch.Writer.Complete(); | |
}); |
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
### Keybase proof | |
I hereby claim: | |
* I am ronnieoverby on github. | |
* I am ronnieoverby (https://keybase.io/ronnieoverby) on keybase. | |
* I have a public key ASCXPI6o5jpbNT7RowJ7h_vBeGh0pzcksHwfhqWFQNVxUgo | |
To claim this, I am signing this object: |
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
https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/data-types/value-types-and-reference-types | |
https://jonskeet.uk/csharp/references.html | |
http://www.albahari.com/valuevsreftypes.aspx |
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
https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/data-types/value-types-and-reference-types | |
https://jonskeet.uk/csharp/references.html | |
http://www.albahari.com/valuevsreftypes.aspx |
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
class BlockingStreams | |
{ | |
public Stream WriteableStream { get; } | |
public Stream ReadableStream { get; } | |
private readonly CancellationToken _ct; | |
private readonly BlockingCollection<MemoryStream> _blocks; | |
public BlockingStreams(int? maxWrites = null, CancellationToken ct = default) |
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
var queue = new BlockingCollection<object>(); | |
// ... meanwhile some other thread is adding to the queue | |
Task.Run(() => | |
{ | |
for (int i = 0; i < 10; i++) | |
queue.Add(i); | |
queue.CompleteAdding(); | |
}); |
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
<Query Kind="Program"> | |
<NuGetReference>Microsoft.CodeAnalysis.CSharp</NuGetReference> | |
<Namespace>LINQPad.ObjectModel</Namespace> | |
<Namespace>Microsoft.CodeAnalysis</Namespace> | |
<Namespace>Microsoft.CodeAnalysis.CSharp</Namespace> | |
<Namespace>Microsoft.CodeAnalysis.Emit</Namespace> | |
<Namespace>static LINQPad.Util</Namespace> | |
<Namespace>static System.IO.Path</Namespace> | |
<Namespace>static System.Reflection.Assembly</Namespace> | |
<Namespace>static System.Reflection.BindingFlags</Namespace> |
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
void Main() | |
{ | |
var a = new BigDecimal( | |
BigInteger.Parse("9999999999999999999999999999999999999999999999999"), 0); | |
var b = new BigDecimal( | |
BigInteger.Parse("99999999999999999999998999999988998899999999999"), | |
17); | |
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 class AttachmentExtensions | |
{ | |
private static readonly ConditionalWeakTable<object, ConcurrentDictionary<string, object>> _attachmentTable = | |
new ConditionalWeakTable<object, ConcurrentDictionary<string, object>>(); | |
/// <summary> | |
/// Atomically gets or sets an attached value if it's found. | |
/// </summary> | |
public static AttachmentResult<T> GetOrSetAttached<T>(this object host, Func<T> factory, string key = null) | |
{ |
NewerOlder