Skip to content

Instantly share code, notes, and snippets.

View dbones's full-sized avatar
☄️
Coding the dotNEXT

Dave R. dbones

☄️
Coding the dotNEXT
View GitHub Profile
@dbones
dbones / InternalContainer.cs
Created July 15, 2013 19:42
simple internal IoC container, based on the ninject one. only handles singletons.
public interface IContainer : IDisposable
{
void Add(Type contract, Type service);
object Resolve(Type contract);
}
/// <summary>
/// this contaier is a simple container which handles all contracts as singletons
/// </summary>
@dbones
dbones / nav
Created September 5, 2013 23:24
wondering how you may implement a menu (navigation)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TestMenuIdea
{
class Program
{
static void Main(string[] args)
@dbones
dbones / ConfigSample.cs
Last active December 23, 2015 02:39
This shows a simple pattern for implementing Configurations and setting them. The code shows a sample logger which is set-up via the code, you could easily extend it to configure by XML
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Mime;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
@dbones
dbones / gist:7298086
Last active December 27, 2015 08:39
FluentRegex - create a regex text via a fluent interface
using System;
using System.Collections.Generic;
using System.Linq;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
namespace FluentRegex
{
@dbones
dbones / elasticMapping2.cs
Created April 9, 2016 19:22
creating a mapping using elastic + nest 2.0 (the previous does not work any more)
namespace Indexing2
{
using System;
using Nest;
class Program
{
static void Main(string[] args)
{
var settings = new ConnectionSettings(new Uri("http://index:9200"));
@dbones
dbones / Program.cs
Created August 4, 2016 14:28
Container test, looking into Structuremap WIP
namespace ContainerTest
{
using System;
using System.Collections.Generic;
using System.Linq;
using Castle.Core;
using Castle.MicroKernel;
using Castle.MicroKernel.Context;
using Castle.MicroKernel.Lifestyle;
using Castle.MicroKernel.Registration;
@dbones
dbones / WindsorJobActivator.cs
Created September 2, 2016 08:35
WindsorJobActivator.cs for Hangfire
public class WindsorJobActivator : JobActivator
{
private readonly IWindsorContainer _container;
public WindsorJobActivator(IWindsorContainer container)
{
_container = container;
}
@dbones
dbones / Program.cs
Created September 26, 2016 08:28 — forked from ovrmrw/Program.cs
Topshelf + OWIN Self-Host + ASP.NET WebAPI + Ninject
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Tracing;
using System.Reflection;
using Owin;
@dbones
dbones / docker.yaml
Created November 8, 2016 18:59
voting app
app-lb:
ports:
- 80:80
labels:
io.rancher.scheduler.affinity:host_label: server=proxy
io.rancher.loadbalancer.target.result: result.app:80=80
io.rancher.loadbalancer.target.vote: vote.app:80=80
tty: true
image: rancher/load-balancer-service
links:
@dbones
dbones / configmap.yaml
Created November 3, 2019 20:45
FluentD with elasicoverride
apiVersion: v1
kind: ConfigMap
metadata:
name: fluentdconf
namespace: kube-logging
data:
fluent.conf: |-
# AUTOMATICALLY GENERATED
# DO NOT EDIT THIS FILE DIRECTLY, USE /templates/conf/fluent.conf.erb