Skip to content

Instantly share code, notes, and snippets.

View thecodejunkie's full-sized avatar

Andreas Håkansson thecodejunkie

View GitHub Profile
@thecodejunkie
thecodejunkie / highlight.xml
Last active October 31, 2019 21:24
Explicit cs Implict reference of NETStandard.Library
Are there any differences to the two approaches below? I.e impliclity ending up with the package reference to
NETStandard.Library 1.6.1, dvs running with DisableImplicitFrameworkReferences = true and adding an explicit
reference to NETStandard.Library?
Any pros/cons for either? Any hidden/implicit impacts?
See https://github.com/dotnet/sdk/pull/633#issuecomment-272515440 for some context
<Project Sdk="Microsoft.NET.Sdk">
@thecodejunkie
thecodejunkie / MyRouteModule.cs
Created January 17, 2017 12:45
Sample of a custom IRouteResolver
public class MyRouteModule : NancyModule
{
public MyRouteModule()
{
Get("/", _ =>
{
return "Hi";
});
Post("/", _ =>

Keybase proof

I hereby claim:

  • I am thecodejunkie on github.
  • I am thecodejunkie (https://keybase.io/thecodejunkie) on keybase.
  • I have a public key whose fingerprint is 0D5C 5F57 7A5A 8A4D 771A D59F DCB2 894E 8B78 6A6E

To claim this, I am signing this object:

@thecodejunkie
thecodejunkie / gist:f1c5fdd30c97d8e0d766
Created November 7, 2015 11:05
Delete merged branches, both in origin and locally
1. Delete the branches in my remote `origin`
git branch -r --merged | grep "\origin" | grep -v "\master" | cut -d"/" -f 2 | xargs -n 1 git push origin --delete
2. Delete the branches locally
git branch --merged master | grep -v "\master" | xargs -n 1 git branch -D
@thecodejunkie
thecodejunkie / gist:d9fe7156e746d256c3b6
Last active August 29, 2015 14:07
Spike of a Random composite node for a Behavior Tree
public class Random : BehaviorComposite
{
private readonly System.Random random;
private Behavior current;
public Random(params Behavior[] behaviors)
: this(null, behaviors)
{
}
@thecodejunkie
thecodejunkie / gist:a64abf8b6f96607ba038
Created September 9, 2014 18:19
Dynamics and async put
Put["/put/{name}", true] = async (parameters, ct) =>
{
var q = parameters.name;
var z = (string)parameters.name;
return 200;
};
PUT http://localhost:59017/put/andreas HTTP/1.1
@thecodejunkie
thecodejunkie / gist:204297b492e1ab5b3e2f
Last active August 29, 2015 14:04
Different ways of passing in querystring parameters using the Browser class
public class TestFixture
{
private readonly Browser browser;
public TestFixture()
{
this.browser = new Browser(with => with.Module<QueryStringTestModule>());
}
[Fact]
@thecodejunkie
thecodejunkie / gist:cc5c1dde24cd81435723
Last active August 29, 2015 14:04
Spiking Nancy and Jails integration
namespace JailsPlayground
{
using System;
using System.Collections.Generic;
using System.Reflection;
using Jails;
using Jails.Extensions.Roslyn;
using Jails.Isolators.AppDomain;
using Nancy;
using Nancy.Bootstrapper;
@thecodejunkie
thecodejunkie / new_gist_file
Created January 24, 2014 10:48
Simple sample that shows how to replace the route handler lambda with a function + using constructor dependencies from the module
using Nancy;
public class IndexModule : NancyModule
{
private readonly IFoo foo;
public IndexModule(IFoo foo)
{
this.foo = foo;
Get["/"] = DoSomething;
@thecodejunkie
thecodejunkie / gist:8211769
Created January 1, 2014 21:40
I want to be able to pass in what order the colors should be iterated, while maintaining the call to the histogram (i.e needs to be called with the right values)
var axisTotal = 0;
var stackedSumByColor = new int[128];
for (var r = dimension.Min; r <= dimension.Max; r++)
{
var sum = 0;
for (var g = dimension.Min; g <= dimension.Max; g++)
{
for (var b = dimension.Min; b <= dimension.Max; b++)
{