This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading.Tasks; | |
using System.Web.Mvc; | |
using JetBrains.Annotations; | |
using ShortBus; | |
public abstract class BaseController : Controller | |
{ | |
public IMediator Mediator { get; set; } | |
protected Response<TResult> Query<TResult>(IQuery<TResult> query) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# adapted from http://notes.jimlindley.com/2008/3/25/git-svn-that-works-for-me | |
# initial setup | |
git svn clone <svn_repo> | |
# begin the workflow | |
git svn fetch -r HEAD --ignore-paths="Package.zip" # aliased to 'git up', my Package.zip is very large. | |
git svn rebase -l # we just updated, no need to go back to the svn repo | |
# 99% of daily workflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool IsSubclassOfOpenGeneric(this Type type, Type generic) | |
{ | |
// fine! | |
return type != typeof(object) && | |
(generic == (type.IsGenericType ? type.GetGenericTypeDefinition() : type) || | |
type.BaseType.IsSubclassOfOpenGeneric(generic)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using Subroute.Common; | |
using System.Configuration; | |
using System.Linq; | |
using System.Collections.Generic; | |
using Newtonsoft.Json; | |
// Slack webhook example | |
namespace Subroute.Container | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is an example how to perform multi-select faceting in ElasticSearch. | |
Selecting multiple values from the same facet will result in an OR filter between each of the values: | |
(facet1.value1 OR facet1.value2) | |
Faceting on more than one facet will result in an AND filter between each facet: | |
(facet1.value1 OR facet1.value2) AND (facet2.value1) | |
I have chosen to update the counts for each facet the selected value DOES NOT belong to since we are performing an AND between each facet. I have included an example that shows how to keep the counts if you don't want to do this (filter0.sh). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Data.Entity; | |
public static class EntityFrameworkExtensions | |
{ | |
/// <summary> | |
/// Given an id, creates a reference to an existing (persisted) *unchanged* entity | |
/// </summary> | |
/// <typeparam name="TEntity">Entity CLR type</typeparam> | |
/// <param name="db">DbContext</param> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Mvc; | |
using JetBrains.Annotations; | |
using ShortBus; | |
public abstract class BaseController : Controller | |
{ | |
public IMediator Mediator { get; set; } | |
protected Response<TResult> Query<TResult>(IQuery<TResult> query) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Reflection; | |
using System.Text; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
public static class ShouldExtensions | |
{ | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function global:Delete-BinObj() | |
{ | |
$path = join-path $solutionScriptsContainer '..' -resolve | |
Get-ChildItem $path -include bin,obj -recurse -Force | remove-item -force -recurse | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomConvention : Convention | |
{ | |
public CustomConvention() | |
{ | |
Cases.Where(StartsWith("should", "it")); | |
FixtureExecution.CreateInstancePerFixture(); | |
InstanceExecution.SetUpTearDown(StartsWithWhen(), StartsWithAfter()); | |
} |
NewerOlder