Skip to content

Instantly share code, notes, and snippets.

View lhaussknecht's full-sized avatar

Louis Haußknecht lhaussknecht

View GitHub Profile
@lhaussknecht
lhaussknecht / gist:6af388e03255e89b131b
Created October 20, 2015 08:07
paket install output
Paket version 2.15.6.0
Resolving packages for group Main:
- Castle.Windsor-log4net 3.3.0
- Castle.Core-log4net 3.3.3
- log4net 1.2.10
- Castle.Core 3.3.3
- Castle.LoggingFacility 3.3.0
- Castle.Windsor 3.3.0
- NUnit 2.6.4
Locked version resolution written to C:\Users\haussknecht\Documents\visual studio 2013\Projects\TestPaket\paket.lock
@lhaussknecht
lhaussknecht / Volume.ahk
Created September 4, 2015 09:11
Autohotkey Volume control (German qwrtz layout)
#SingleInstance FORCE
;Volume UP Windows ALT +
#!+::
Send {Volume_Up}
return
;Volume down Windows ALT -
#!-::
Send {Volume_down}
@lhaussknecht
lhaussknecht / packApp.ps1
Created August 12, 2015 10:08
Powershell script to pack a Chrome App or Chrome Extension without chrome
#Pack a ChromeApp / ChromeExtension
param(
[Parameter(Mandatory=$true)]
[string]
$dir,
[Parameter(Mandatory=$true)]
[string]
[string]$key
,
@lhaussknecht
lhaussknecht / SerialTests.cs
Created August 14, 2012 15:30
GetAvailableComPorts
public string[] GetAvailableComPorts()
{
var l = new List<string>();
for (int i = 1; i < 20; i++)
{
var portname = string.Format("COM{0}", i);
try
{
using (var s = new System.IO.Ports.SerialPort(portname))
@lhaussknecht
lhaussknecht / Account.vb
Created April 12, 2012 16:07
MSpec in VB.net
Public Class Account
Public Property Balance() As Decimal
Public Sub Transfer(ByVal amount As Decimal, ByVal toAccount As Account)
If amount > Balance Then
Throw New Exception(String.Format("Cannot transfer ${0}. The available balance is ${1}.", amount, Balance))
End If
toAccount.Balance += amount
Balance -= amount
@lhaussknecht
lhaussknecht / gist:1125166
Created August 4, 2011 13:38
Module with RavenDB
public class Home : PersistentModule
{
public Home() : base("/customers")
{
Get["/browse/{firstLetter}"] = parameters =>
{
string firstLetter = parameters.firstLetter;
var customers = DocumentSession.Query<Customer>()
.Where(x => x.Name.StartsWith(firstLetter))
.ToList();
@lhaussknecht
lhaussknecht / gist:1124973
Created August 4, 2011 11:08
PersistentModule
public abstract class PersistentModule : NancyModule
{
protected PersistentModule()
{
}
protected PersistentModule(string modulePath) : base(modulePath)
{
}
@lhaussknecht
lhaussknecht / gist:1124905
Created August 4, 2011 10:16
RavenAwareModuleBuilder
public class RavenAwareModuleBuilder : INancyModuleBuilder
{
private readonly IViewFactory viewFactory;
private readonly IResponseFormatter responseFormatter;
private readonly IModelBinderLocator modelBinderLocator;
private readonly IRavenSessionProvider _ravenSessionProvider;
public RavenAwareModuleBuilder(IViewFactory viewFactory, IResponseFormatter responseFormatter,
IModelBinderLocator modelBinderLocator,
IRavenSessionProvider ravenSessionProvider)
@lhaussknecht
lhaussknecht / gist:1124901
Created August 4, 2011 10:13
Bootstrapper
public class RavenBootstrapper : DefaultNancyBootstrapper
{
protected override NancyInternalConfiguration InternalConfiguration
{
get { return NancyInternalConfiguration.WithOverrides(x => x.NancyModuleBuilder = typeof (RavenAwareModuleBuilder)); }
}
}
@lhaussknecht
lhaussknecht / gist:1124884
Created August 4, 2011 10:01
RavenSessionProvider
public interface IRavenSessionProvider
{
IDocumentSession GetSession();
}
public class RavenSessionProvider : IRavenSessionProvider
{
private static IDocumentStore _documentStore;
public static IDocumentStore DocumentStore