Skip to content

Instantly share code, notes, and snippets.

View harrybiscuit's full-sized avatar

Harry Biscuit harrybiscuit

View GitHub Profile
let getConfigFiles workingDirectory =
match Directory.Exists(workingDirectory) with
| false -> Seq.empty
| _ -> let allFiles = Directory.EnumerateFiles(workingDirectory)
allFiles
|> Seq.filter(fun file -> file.EndsWith(".config"))
@harrybiscuit
harrybiscuit / gist:4757968
Last active December 12, 2015 10:18
How I got NCrunch to run Xunit Theory tests.
module FizzBuzzTests
open FsUnit
open Xunit
open Xunit.Extensions
open FizzBuzzCode
[<Fact>]
public class LoggingConfiguration
{
private static readonly ReaderWriterLockSlim _locker = new ReaderWriterLockSlim();
private static bool _loggersHaveBeenSet;
public static void Initialise()
{
ILogger logger = new Logger(new LogEntryFactory());
InitialiseLogger(logger);
}
@harrybiscuit
harrybiscuit / RavenDB.cs
Created May 16, 2012 22:16
Using WebActivator.PostApplicationStartMethod to create indexes
using Shop.RavenDb;
[assembly: WebActivator.PostApplicationStartMethod(typeof(Shop.App_Start.RavenDB), "Start")]
namespace Shop.App_Start
{
public static class RavenDB
{
/// <summary>
/// Starts the application
@harrybiscuit
harrybiscuit / web.config
Created May 16, 2012 20:52
multi-site-gist-05 - web config entries
<configuration>
<configSections>
<section name="siteDefinition" type="multi_site.Config.SiteDefinition, multi_site.Config"/>
</configSections>
<siteDefinition xmlns="urn:multi_site.Config">
<!-- Other web config items go here -->
</configuration>
@harrybiscuit
harrybiscuit / multi-site-gist-04.cs
Created May 16, 2012 20:32
multi-site-gist-04 - open db session
var siteName = System.Web.Hosting.HostingEnvironment.ApplicationHost.GetSiteName();
var siteDefinition = Config.SiteDefinition.Instance;
CultureInfo culture = null;
foreach (Config.Site site in siteDefinition.Sites) {
if (site.SiteName == siteName)
culture = new CultureInfo(site.Culture);
}
StoreSession = DocumentStore.OpenSession(siteName);
@harrybiscuit
harrybiscuit / muti-site-gist-03-home-controller.cs
Created May 16, 2012 20:09
multi-site-gist-03 - get the cluture
var siteName = System.Web.Hosting.HostingEnvironment.ApplicationHost.GetSiteName();
var siteDefinition = Config.SiteDefinition.Instance;
CultureInfo culture = null;
foreach (Config.Site site in siteDefinition.Sites) {
if (site.SiteName == siteName)
culture = new CultureInfo(site.Culture);
}
@harrybiscuit
harrybiscuit / multi-site-gist-02.xml
Created May 16, 2012 19:54
multi-site-gist-02 - site defintion
<?xml version="1.0"?>
<siteDefinition xmlns="urn:multi_site.Config">
<sites>
<site siteName="store-uk" culture ="en-GB"/>
<site siteName="store-fr" culture ="fr-FR"/>
</sites>
</siteDefinition>
@harrybiscuit
harrybiscuit / multi-site-gist-01.xml
Created May 14, 2012 23:23
multi-site-gist-01 - auto-generated site defintion
<?xml version="1.0"?>
<!--
<auto-generated>
This code was generated by a tool.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
</auto-generated>
-->
<configuration>
@harrybiscuit
harrybiscuit / CreateJunction.ps1
Created February 21, 2012 15:43
Powershell script to create a junction using sysinternal junction.exe
$junctionPath = ".\junction.exe"
$toBeCreated = "c:\MyNewJunction";
if(!(Test-Path $junctionPath)){
Write-Host "Expected Junction.exe to be in the same folder as this script file. This file is required to create the new junction."
Write-Host "Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
exit
}
Write-Host "Found junction.exe"
Write-Host "Enter the full path to the existing folder to which we will point the junction"