Skip to content

Instantly share code, notes, and snippets.

@DamianReeves
DamianReeves / UnityContainerExtensions.cs
Last active May 11, 2016 19:55
RegisterExportFactory in Unity
namespace Unity.Extensions {
using Microsoft.Practices.Unity;
public static class UnityContainerExtensions
{
public static IUnityContainer RegisterExportFactory<T>(this IUnityContainer container)
{
return container.RegisterType<ExportFactory<T>>(new InjectionFactory(CreateExportFactory<T>));
}
private static ExportFactory<T> CreateExportFactory<T>(IUnityContainer container, Type type, string name)
@DamianReeves
DamianReeves / ISplashPresenter
Created May 30, 2014 15:54
Dispatcher Issue
using System.Threading.Tasks;
namespace MyCompany.Windows.Reactive
{
public interface ISplashPresenter
{
Task ShowAsync();
Task DisplayMessage(string messageFormat, params object[] args);
Task CloseAsync();
}
configuration ProGet_Install
{
param
(
# Target node to apply the configuration
[string] $NodeName = 'localhost',
[ValidateSet('Express','Trial','LicenseKey')]
[string] $Edition = "LicenseKey", #Choices are Trial, LicenseKey, and Express
[string] $LicenseKey="",
[string] $Email = "[email protected]",
@DamianReeves
DamianReeves / csvToTable
Created March 24, 2015 12:11
Oracle CsvToTable Function
create or replace function csvToTable(p_clob_text in varchar2)
return sys.dbms_debug_vc2coll pipelined
is
next_new_line_indx pls_integer;
remaining_text varchar2(20000);
next_piece_for_piping varchar2(20000);
begin
remaining_text := p_clob_text;
loop
@DamianReeves
DamianReeves / Get-NuGet.ps1
Created April 1, 2015 12:34
Download NuGet
param (
[string]$NuGetDir=".\.nuget\"
)
function Download-File {
param (
[string]$url,
[string]$file
)
Write-Host "Downloading $url to $file"
@DamianReeves
DamianReeves / .gitconfig
Created April 18, 2015 01:44
Using Visual Studio AS Git Merge Tool
[diff]
tool = vsdiffmerge
[difftool]
prompt = true
[difftool "vsdiffmerge"]
cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //t
keepbackup = false
trustexistcode = true
[merge]
tool = vsdiffmerge
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Akka.Persistence.Sandbox
{
using Akka.Actor;
public class MyPersistenceExtension: IExtension
// credit: http://madskristensen.net/post/A-shorter-and-URL-friendly-GUID
using System;
public static class GuidEncoder
{
public static string Encode(string guidText)
{
Guid guid = new Guid(guidText);
return Encode(guid);
}
@DamianReeves
DamianReeves / Install-IISWebApplication.ps1
Last active June 5, 2018 11:52
DevOps-WebAdministration
<#
.SYNOPSIS
Script to restore nuget packages
.DESCRIPTION
Script to restore nuget packages
.PARAMETER Site
The web site name.
@DamianReeves
DamianReeves / InitializeDatabase.template.sql
Created January 13, 2016 20:35
Even Oracle schema template
declare
table_count integer;
begin
select count (object_id) into table_count from user_objects where exists (
select object_name from user_objects where (object_name = upper('{0}') and object_type = 'TABLE'));
if table_count = 0 then
dbms_output.put_line('Creating the {0} table');
execute immediate (