Skip to content

Instantly share code, notes, and snippets.

View jeremiahredekop's full-sized avatar
😀
life is good.

Jeremiah Redekop jeremiahredekop

😀
life is good.
View GitHub Profile
@jeremiahredekop
jeremiahredekop / handler.cs
Last active November 19, 2015 18:20
sample sql denormalizer using paramol & projac
using Paramol.SqlClient;
using Projac;
namespace Sample
{
public static class PortfolioProjectionUsingBuilder
{
public static readonly AnonymousSqlProjection Instance = new AnonymousSqlProjectionBuilder().
When<PortfolioAdded>(@event =>
TSql.NonQueryStatement(
param (
[Int]
$clusterSize,
[string]
$VMName,
[Int]
$nodeNumber,
[Int]
$IntIp,
[Int]
@jeremiahredekop
jeremiahredekop / PipingExtensions.cs
Last active July 21, 2017 17:50
Piping c# extension methods
public static class PipingExtensions
{
/// <summary>
/// Take an object, pipe it into a function, and return the result.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <param name="obj"></param>
/// <param name="f"></param>
/// <returns></returns>
/// Code to bind mailbox processors to azure storage queues.
module AzureMailboxProcessor
open System
module private Async =
let AwaitTaskEmpty = Async.AwaitIAsyncResult >> Async.Ignore
module private Option =
let fromNullable (nullable:Nullable<_>) = if nullable.HasValue then Some nullable.Value else None
let toNullable = function
@jeremiahredekop
jeremiahredekop / NaturalScrolling.ahk
Created April 16, 2014 15:29
Natural scrolling auto hotkey script
; Reverse Scrolling Script by How-To Geek
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance off
#MaxHotkeysPerInterval 1000
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
WheelUp::
Send {WheelDown}
@ECHO OFF
SETLOCAL
SET VERSION=%1
SET NUGET=buildsupport\nuget.exe
FOR %%G IN (packaging\nuget\*.nuspec) DO (
%NUGET% pack %%G -Version %VERSION% -Symbols -o artifacts
)
@jeremiahredekop
jeremiahredekop / GetMethodInfo.cs
Created July 4, 2012 20:50
Get Method Info for Expression
public MethodInfo GetMethodInfo<TSource>(Expression<Action<TSource>> methodLambda)
{
Type type = typeof(TSource);
var member = methodLambda.Body as MethodCallExpression;
if (member == null)
throw new ArgumentException(string.Format(
"Expression '{0}' does not refer to a method.",
methodLambda));
@jeremiahredekop
jeremiahredekop / GetMessageHandlerForMessage.cs
Created June 28, 2012 21:04
Get Message Handler For Message
public static class ContainerExtensions
{
public static Delegate GetMessageHandlerForMessage(this ILifetimeScope lifetimeScope, object message)
{
MethodInfo methodInfo = typeof(ContainerExtensions)
.GetMethods(BindingFlags.Static | BindingFlags.NonPublic)
.Single(m => m.Name == "GetMessageHandlerForMessageInternal");
var methodInfo2 = methodInfo.MakeGenericMethod(new[] { message.GetType() });
@jeremiahredekop
jeremiahredekop / composite_root_helpers.cs
Created June 27, 2012 15:41
Composite Root Helpers
public class RelayAutofacInitializer : IAutofacInitializer
{
private readonly IAutofacInitializer _autofacInitializer;
private readonly Action<ContainerBuilder> _init;
public RelayAutofacInitializer(IAutofacInitializer autofacInitializer, Action<ContainerBuilder> init)
{
_autofacInitializer = autofacInitializer;
_init = init;
}
@jeremiahredekop
jeremiahredekop / firstcqrstest.cs
Created December 11, 2011 06:50
My First CQRS Test
[Test]
public void Assert_that_view_can_respond_to_events_via_bus_and_make_dto()
{
var myRepo = _container.Resolve<IRepository<AllProductsViewDto>>();
_bus.PublishEvents(new[]
{
new ProductCreated("Bingo",100)
});