Skip to content

Instantly share code, notes, and snippets.

View gluck's full-sized avatar

Francois Valdy gluck

View GitHub Profile
END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE
IMPORTANT-READ CAREFULLY: This Microsoft End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation (“Microsoft”) for the Microsoft software product identified below, which includes computer software and may include associated media, printed materials, and "online" or electronic documentation ("PRODUCT"). By installing, copying, or otherwise using the PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, do not install, copy or use the PRODUCT.
Microsoft XML Diff and Patch
The PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The PRODUCT is licensed, not sold.
1. GRANT OF LICENSE. This EULA grants you the following rights:
@gluck
gluck / FromEventBenchmark.cs
Last active October 15, 2021 09:03
Benchmark showing performance increase using FromEvent with conversion over FromEventPattern, using BenchmarkDotNet library
[BenchmarkTask(platform: BenchmarkPlatform.X86, jitVersion: BenchmarkJitVersion.LegacyJit)]
[BenchmarkTask(platform: BenchmarkPlatform.X64, jitVersion: BenchmarkJitVersion.LegacyJit)]
[BenchmarkTask(platform: BenchmarkPlatform.X64, jitVersion: BenchmarkJitVersion.RyuJit)]
public class FromEventBenchmark
{
readonly Control control = new Control();
[Benchmark]
public void FromEventPattern()
{
Observable.FromEventPattern<EventHandler, EventArgs>(h => control.SizeChanged += h, h => control.SizeChanged -= h).Select(p => p.EventArgs)
@gluck
gluck / activity.xml
Created July 26, 2015 21:12
Exceptions
<entry>
<record>473</record>
<time>2015/07/26 21:00:15.450</time>
<type>Error</type>
<source>InitializeFieldFromConstructorParameterCodeRefactoringProvider</source>
<description>Node to track is not a descendant of the root.&#x000D;&#x000A; at Microsoft.CodeAnalysis.SyntaxNodeExtensions.TrackNodes[TRoot](TRoot root, IEnumerable`1 nodes)&#x000D;&#x000A; at RefactoringEssentials.CSharp.CodeRefactorings.InitializeFieldFromConstructorParameterCodeRefactoringProvider.&lt;&gt;c__DisplayClass0_1.&lt;ComputeRefactoringsAsync&gt;b__0(CancellationToken t2)&#x000D;&#x000A; at RefactoringEssentials.DocumentChangeAction.GetChangedDocumentAsync(CancellationToken cancellationToken)&#x000D;&#x000A; at Microsoft.CodeAnalysis.CodeActions.CodeAction.&lt;GetChangedSolutionAsync&gt;d__9.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A; at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A; a

Keybase proof

I hereby claim:

  • I am gluck on github.
  • I am gluck (https://keybase.io/gluck) on keybase.
  • I have a public key whose fingerprint is 4157 45DE D8EB 27A5 6789 3CCE 6FF7 6269 A8D9 B80F

To claim this, I am signing this object:

@gluck
gluck / build.gradle
Created March 10, 2014 19:15
Gradle task to run JMH benchmarks
// JMH files along tests, but s/test/perf/ will work just fine to separate
task(runJmh, dependsOn: 'testClasses', type: JavaExec) {
main = 'org.openjdk.jmh.Main'
args '".*"'
classpath = sourceSets.test.runtimeClasspath
}
@gluck
gluck / ObserveLatestOn.cs
Last active December 26, 2015 17:09
ObserveLatestOn version
/// <summary>
/// Requirements:
/// - downstream observer should be called on the provided scheduler
/// - downstream observer OnNext shouldn't be called more than once per delay provided
/// - downstream observer OnNext should be scheduled at most after the given delay
/// - when called, downstream observer OnNext should be given the latest upstream value observed
/// - when upstream OnComplete, downstream should be provided the latest value observed before calling OnComplete (ASAP)
/// - when upstream OnError, downstream should OnError ASAP
/// </summary>
public static IObservable<T> ObserveLatestOn<T>(this IObservable<T> source, TimeSpan delay, IScheduler scheduler)