Skip to content

Instantly share code, notes, and snippets.

View svick's full-sized avatar

Petr Onderka svick

View GitHub Profile
@svick
svick / Program.cs
Last active September 18, 2016 11:59
.Net Core Enumerable.Count optimization
using System.Linq;
public class Program
{
public static void Main()
{
Console.WriteLine(new[] { "not int" }.Select(int.Parse).Count());
}
}
using System;
using System.IO;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Binder = Microsoft.CSharp.RuntimeBinder.Binder;
@svick
svick / NuGet.Config
Created August 28, 2016 13:04
PS SDK
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="ps" value="https://powershell.myget.org/F/powershell-core/api/v3/index.json" />
</packageSources>
</configuration>
@svick
svick / rids.txt
Created July 21, 2016 02:34
List of all RIDs supported in .Net Core 1.0
base
any
win
win-x86
win-x64
win7
win7-x86
win7-x64
win8
win8-x86
@svick
svick / Program.cs
Created July 9, 2016 10:48
Package.Open(Stream) access mode
using System;
using System.Linq;
using System.IO;
using System.IO.Packaging;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
~/hwapp2$ dotnet run
Project hwapp2 (.NETFramework,Version=v4.5.1) will be compiled because expected outputs are missing
Compiling hwapp2 for .NETFramework,Version=v4.5.1
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:01.4149219
@svick
svick / Program.cs
Created July 6, 2016 09:30
Investigating dotnet publish, RuntimeInformation and mono
using System;
using System.Runtime.InteropServices;
public class Program
{
public static void Main()
{
Console.WriteLine(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
}
}
@svick
svick / Program.cs
Created June 10, 2016 16:35
.NET Core PostAsJson alternative: manual
using System;
using System.Net.Http;
using Newtonsoft.Json;
public class Program
{
public static void Main()
{
var data = new { x = 42 };
var url = "https://httpbin.org/post";
****************************
* Building .NET Core CLI *
****************************
Target Package from Standard Goals was overridden in Microsoft.DotNet.Cli.Build.PackageTargets.Package
Target Prepare from Standard Goals was overridden in Microsoft.DotNet.Cli.Build.PrepareTargets.Prepare
Target Compile from Standard Goals was overridden in Microsoft.DotNet.Cli.Build.CompileTargets.Compile
Target Publish from Standard Goals was overridden in Microsoft.DotNet.Cli.Build.PublishTargets.Publish
Target Test from Standard Goals was overridden in Microsoft.DotNet.Cli.Build.TestTargets.Test
RGET >]  Default  (Standard Goals)
RGET >]  Prepare  (Microsoft.DotNet.Cli.Build.PrepareTargets.Prepare)
using System;
using System.Globalization;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
var regions = new[] { "SE", "GB", "IL", "RU", "PK", "FR" };