Skip to content

Instantly share code, notes, and snippets.

View svick's full-sized avatar

Petr Onderka svick

View GitHub Profile
// my solution to https://www.reddit.com/r/cscareerquestions/comments/450l6r/how_do_you_even_approach_a_really_tough_problem/
void Main()
{
var tree = new Node("A",
new Node("B",
new Node("D"),
new Node("E")),
new Node("C",
new Node("F"),
new Node("G")));
@svick
svick / Output.txt
Created February 11, 2016 17:38
PLINQ leak?
Processing 0
Processing 1
Finalizing #0
Processing 2
Processing 3
Finalizing #2
Processing 4
Finalizing #3
Processing 5
Finalizing #4
@svick
svick / Program.cs
Created February 26, 2016 14:56
Get overloads of method per platform from NuGet package
using System;
using System.IO;
using Mono.Cecil;
using System.Linq;
using System.Threading.Tasks;
using System.Net.Http;
using Ionic.Zip;
class Program
{
@svick
svick / overloads.txt
Last active February 26, 2016 15:03
Overloads of Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.UploadFromStreamAsync() per platform
// generated by https://gist.github.com/svick/6a20876f9b6931f96012
dotnet5.4
Task UploadFromStreamAsync(Stream source)
Task UploadFromStreamAsync(Stream source, Int64 length)
Task UploadFromStreamAsync(Stream source, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
Task UploadFromStreamAsync(Stream source, Int64 length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
Task UploadFromStreamAsync(Stream source, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
Task UploadFromStreamAsync(Stream source, Int64 length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
net40
@svick
svick / Query.cs
Created March 9, 2016 23:01
Why roslyn#9606 would be ambiguous
void Main()
{
var a = new C();
// var x = a? +a? +a : a;
var x = (a != null) +a? +a : a;
var y = a? (+a != null) +a : a;
}
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.VisualBasic
Module Module1
Sub Main()
Dim code = "Module Module1
Sub Main()
Console.WriteLine(My.Application.Info.AssemblyName)
E:\Users\Svick\git\corefx\src\System.Diagnostics.Debug\tests\XunitAssemblyAttributes.cs(8,12): error CS7068: Reference to type 'Enum' claims it is defined in this assembly, but it is not defined in source or any added modules
E:\Users\Svick\git\corefx\src\System.Diagnostics.Debug\tests\DebuggerTests.cs(11,10): error CS7068: Reference to type 'Attribute' claims it is defined in this assembly, but it is not defined in source or any added modules
E:\Users\Svick\git\corefx\src\System.Diagnostics.Debug\tests\AttributeTests.cs(13,10): error CS7068: Reference to type 'Attribute' claims it is defined in this assembly, but it is not defined in source or any added modules
E:\Users\Svick\git\corefx\src\System.Diagnostics.Debug\tests\DebuggerTests.cs(17,10): error CS7068: Reference to type 'Attribute' claims it is defined in this assembly, but it is not defined in source or any added modules
E:\Users\Svick\git\corefx\src\System.Diagnostics.Debug\tests\AttributeTests.cs(32,10): error CS7068: Reference to type 'Attribute'
@svick
svick / project.json
Last active April 5, 2016 21:53
.Net Core NetworkInformation issues on Ubuntu
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"System.Net.NetworkInformation": "4.1.0-rc3-23910"
},
"frameworks": {
"dnxcore50": {
using System;
using Microsoft.CodeAnalysis.CSharp.Scripting;
using Microsoft.CodeAnalysis.Scripting;
namespace ConsoleApplication1
{
class Program
{
static void Main()
{
{
"version": "4.0.0-*",
"commands": {
"Tryouts": "Tryouts"
},
"compilationOptions": {
"allowUnsafe": true,
"warningsAsErrors": false,
"emitEntryPoint": true
},