Skip to content

Instantly share code, notes, and snippets.

View christiansparre's full-sized avatar

Christian Sparre christiansparre

View GitHub Profile
@christiansparre
christiansparre / SqlCeOrmLiteDialectProvider.cs
Created February 16, 2012 08:10
Sql Server Compact dialect provider for OrmLite
using System;
using System.IO;
using System.Collections.Generic;
using System.Data.SqlServerCe;
using ServiceStack.OrmLite.SqlServer;
namespace Slyngelstat.OrmLite.SqlCe
{
public class SqlCeOrmLiteDialectProvider : SqlServerOrmLiteDialectProvider
{
@christiansparre
christiansparre / GoogleOAuth2Provider.cs
Created October 18, 2014 14:18
Simple Google OAuth 2 provider
using System.Net;
using System.Web;
using RestSharp;
namespace Slyngelstat
{
public class GoogleOAuth2Provider
{
public string GetAuthenticateRedirectionUrl(string clientId, string callbackUrl, string scope, string state = null)
{
@christiansparre
christiansparre / AspNetDependencyResolver.cs
Created July 9, 2015 19:41
Simple Akka.NET DependencyResolver for ASP.NET 5
public class AspNetDependencyResolver : IDependencyResolver
{
private readonly IServiceProvider _aspnetServiceProvider;
private readonly ActorSystem _system;
private ConcurrentDictionary<string, Type> _typeCache;
public AspNetDependencyResolver(IServiceProvider aspnetServiceProvider, ActorSystem system)
{
_aspnetServiceProvider = aspnetServiceProvider;
_system = system;
@christiansparre
christiansparre / Client.cs
Created December 17, 2015 09:24
AkkaRemoteMessageOrder
using System;
using Akka.Actor;
using Akka.Configuration;
namespace Client
{
class Program
{
static void Main(string[] args)
{
@christiansparre
christiansparre / reinstall.ps1
Created February 16, 2016 20:33
Reinstall nuget package
Param(
[string]$packageName,
[string]$source
)
UnInstall-Package $packageName -RemoveDependencies -Force -ErrorAction SilentlyContinue
Install-Package $packageName -IncludePreRelease -Source $source
@christiansparre
christiansparre / Program.cs
Created February 24, 2016 19:37
NancyFX vs Web API
using System;
using System.Web.Http;
using Microsoft.Owin.Hosting;
using Nancy;
using Owin;
namespace ConsoleApplication4
{
class Program
{
@christiansparre
christiansparre / SysStop.cs
Created July 3, 2016 14:44
Sys.Stop(); not working as expected
[Fact]
public void should_terminate_but_does_not()
{
var a = CreateTestProbe();
Watch(a);
Sys.Stop(a);
ExpectTerminated(a);
@christiansparre
christiansparre / AzureQueueStorageSink.cs
Last active August 27, 2017 14:03
Azure Queue Storage Serilog Sink
public class AzureQueueStorageSink : ILogEventSink
{
CloudQueue _queue;
ITextFormatter _formatter;
public AzureQueueStorageSink(CloudQueue queue, ITextFormatter formatter)
{
_queue = queue;
_formatter = formatter;
}
@christiansparre
christiansparre / boxstarter.ps1
Last active November 2, 2019 13:32
Testing out Boxstarter
# Description: Boxstarter Script
# Author: Christian Sparre (modified from Jess Frazelle's)
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
# start http://boxstarter.org/package/nr/url?<URL-TO-RAW-GIST>
version: '3'
services:
vstsdockerbuild.tests:
environment:
- BLOWUP
image: vstsdockerbuild.tests
build:
context: .
dockerfile: tests/VstsDockerBuild.Tests/Dockerfile