Skip to content

Instantly share code, notes, and snippets.

View serbrech's full-sized avatar
🤙
Working from home

Stéphane Erbrech serbrech

🤙
Working from home
View GitHub Profile
@serbrech
serbrech / grant_to_all_db.sql
Created April 14, 2015 10:18
useful script to grant rights
SET NOCOUNT ON;
DECLARE @user_name SYSNAME
, @login_name SYSNAME;
SELECT @user_name = '',
@login_name = ''
SELECT '
USE ' + QUOTENAME(NAME) + ';

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht
@serbrech
serbrech / gist:e45617cceafcb1ffba25
Last active August 29, 2015 14:07
EquivalenceFail.cs
using FluentAssertions;
using NUnit.Framework;
namespace EquivalentTest
{
[TestFixture]
public class EquivalenceTest
{
[Test]
public void Test()
@serbrech
serbrech / roundhouse.ps1
Last active February 9, 2017 14:01
Powershell roundhouse wrapper
function Invoke-Roundhouse {
param(
[alias("env")]$environment="LOCAL",
$server="(local)",
$dbName="DB"
)
$scriptPath = Split-Path (Get-PSCallStack)[1].ScriptName
write-host "base path : $scriptPath"
$sql_files_directory= Join-Path $scriptPath "db\DBScriptFolder"
@serbrech
serbrech / MsDeploy.ps1
Created December 17, 2013 11:57
Powershell wrapper around msdeploy.exe
function DeployWebsite($Package, $Server, $IISSite, $App, $Username, $Password) {
$MSDeployKey = 'HKLM:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3'
if(!(Test-Path $MSDeployKey)) {
throw "Could not find MSDeploy. Use Web Platform Installer to install the 'Web Deployment Tool' and re-run this command"
}
$InstallPath = (Get-ItemProperty $MSDeployKey).InstallPath
if(!$InstallPath -or !(Test-Path $InstallPath)) {
throw "Could not find MSDeploy. Use Web Platform Installer to install the 'Web Deployment Tool' and re-run this command"
}
@serbrech
serbrech / ServiceCall.cs
Last active December 21, 2015 12:18
My little wcf service call helper class to handle try catch and close/abort the proxy.
public static class ServiceCall
{
public static T Try<T>(ICommunicationObject service, Func<T> call)
{
try
{
if (service != null)
service.Open();
return call();
}
using Xunit;
namespace Test
{
public class Tests
{
[Fact]
public void XmlReaderTest()
{
string example =
public class EventStreamResponse : Response
{
public EventStreamResponse(IResponseFormatter formatter, string id, dynamic body)
{
var serializer = formatter.Serializers.FirstOrDefault(s => s.CanSerialize("application/json"));
ContentType = "text/event-stream";
Contents = s =>
{
var idBytes = Encoding.UTF8.GetBytes(id + "\n");
s.Write(idBytes, 0, idBytes.Length);
@serbrech
serbrech / DataReaderTestHelper.cs
Created September 13, 2012 12:05
DataReaderTestHelper
public abstract class DataReaderTestHelper
{
private readonly string _tableName;
public abstract IEnumerable<string> GetColumns();
protected DataReaderTestHelper(string tableName = "fakeTable")
{
_tableName = tableName;
}
@serbrech
serbrech / server.cs
Created May 4, 2012 08:39
Stable server
AppDomain.CurrentDomain.UnhandledException
+= new UnhandledExceptionEventHandler(UnhandledException);
static void UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
}