Skip to content

Instantly share code, notes, and snippets.

@joncloud
joncloud / Log.txt
Created March 23, 2018 21:34
ASP.NET MVC Service Disposal
Using launch settings from C:\Users\jberube\source\repos\WebApplication2\WebApplication2\Properties\launchSettings.json...
Hosting environment: Development
Content root path: C:\Users\jberube\source\repos\WebApplication2\WebApplication2
Now listening on: http://localhost:22449
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:22449/singleton
info: WebApplication2.Program.Test[0]
new Singleton()
info: WebApplication2.Program.Test[0]
$Expression = [regex] '^([^\s#]*)\s*([^\s#]*)\s*(#.*|)$'
Get-Content $env:windir\system32\Drivers\etc\services `
| ForEach-Object { $Expression.Match($_) } `
| ForEach-Object {
@{
Name = $_.Groups[1].Value;
Port = $_.Groups[2].Value;
Comment = $_.Groups[3].Value
}
}
BenchmarkDotNet=v0.10.11, OS=Windows 10 Redstone 2 [1703, Creators Update] (10.0.15063.909)
Processor=Intel Core i7-4870HQ CPU 2.50GHz (Haswell), ProcessorCount=8
Frequency=2435765 Hz, Resolution=410.5486 ns, Timer=TSC
.NET Core SDK=2.1.4
  [Host]     : .NET Core 2.0.5 (Framework 4.6.26020.03), 64bit RyuJIT
  DefaultJob : .NET Core 2.0.5 (Framework 4.6.26020.03), 64bit RyuJIT
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.6.1" />
</ItemGroup>
$Prefix = Get-ChildItem -Recurse -Depth 2 -Filter *.csproj `
| ForEach-Object { [Xml]$A = $_ | Get-Content; $A.Project.PropertyGroup.VersionPrefix } `
| Where-Object { $_ -ne $null -and $_ -ne '' } `
| Select-Object -First 1
If ($IsBeta -eq "1") {
$Parts = $BuildNumber.Split('.')
$Date = $Parts[0]
$Sequence = $Parts[1] / 1
$Suffix = "-beta" + $Date + $Sequence.ToString("000")
@joncloud
joncloud / Client.ts
Last active November 4, 2017 02:28
File Upload
const formData = new FormData();
const blob = new Blob(['a', 'b', 'c', 'd']);
formData.append("image", blob);
formData.append('message', 'my message');
formData.append('visibility', 'shown');
formData.append('replyStatusId', '123');
formData.append('sensitive', 'true');
formData.append('spoilerText', '**SPOILERS**');
this.http.post('/home/upload', formData)
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace ConsoleApp5
{
@joncloud
joncloud / Program.cs
Created August 7, 2017 14:36
Stopwatch Performance
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System;
using System.Diagnostics;
namespace ConsoleApp37
{
class Program
{
static void Main(string[] args)
@joncloud
joncloud / pr.md
Last active April 10, 2021 07:35
Checkout vsts pull requests locally

Forked from piscisaureus

Locate the section for your vsts remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = ssh://my-vsts@my-vsts.visualstudio.com:22/DefaultCollection/Project-Name/_git/Repo-Name
class FilterTest
{
public FilterTest(Dictionary<Type, object> parameters)
{
HttpContext httpContext = new DefaultHttpContext();
RouteData routeData = new RouteData();
List<ParameterDescriptor> parameterDescriptors =
parameters.Select(pair => new ParameterDescriptor
{
BindingInfo = new BindingInfo