Skip to content

Instantly share code, notes, and snippets.

@herecydev
herecydev / ArrayTest
Created March 26, 2015 13:13
Xunit bug when data is an array
public class Tests
{
//Why is this not discovered?
[MyArrayTest]
public void ThisDoesntWork(byte[] bytes)
{
Xunit.Assert.True(true);
}
[MyStringTest]
@herecydev
herecydev / gist:081a7703866f19005b95
Created April 24, 2015 08:12
Moq issue with many observers
public interface IMakeStuff : IObserver<int>, IObserver<string>, IObserver<bool> { }
public class Tests
{
[Fact]
public void SimpleTest()
{
var maker = new Mock<IMakeStuff>()
// Exception here
namespace ClassLibrary1
{
public class Class1
{
public Class1()
{
var x = new DiagnosticMessage();
}
}
}
using Microsoft.ServiceBus.Messaging;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace QueueClientRepro
{
@herecydev
herecydev / ValuesController.cs
Last active November 23, 2015 21:37
Kestrel https
using System.Collections.Generic;
using Microsoft.AspNet.Mvc;
namespace WebApplication1.Controllers
{
[Route("api/[controller]")]
[RequireHttps]
public class ValuesController : Controller
{
// GET: api/values
@herecydev
herecydev / Startup.cs
Created April 29, 2016 07:40
RedirectLoop
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder().AddJsonFile("appsettings.json");
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; set; }
@herecydev
herecydev / Helloworld.cs
Last active October 10, 2016 19:43
Merge problem
//Instatiate A and call start
public class A
{
private readonly C _c;
public A()
{
_c = new C();
var b = new B(new[] { _c });
declare type DataReceived = (data: any) => void;
class Connection {
constructor() {
let thisHubConnection = this;
this.dataReceived = data => {
this.log(data);
thisHubConnection.log(data);
};
@herecydev
herecydev / base.js
Last active March 15, 2017 12:04
WebpackMerge array
let clientConfig = {
entry: "./src/website/js/App.tsx"
}
let serverConfig = {
entry: "./src/server/server.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: "server.js",
},
@herecydev
herecydev / gist:d804be07f0a2909bbe88827fc7395500
Created April 20, 2017 10:10
Dynamic resolver and proxy pass for nginx
http {
resolver 127.0.0.11 valid=1s;
server {
listen 80;
set $foo "http://foo:80";
set $bar "http://bar:80";
location /foo/ {
rewrite ^/foo/(.*) /$1 break;