Skip to content

Instantly share code, notes, and snippets.

@ToJans
ToJans / example.cs
Created June 29, 2011 10:04
Alternative join/alias syntax for Simple.Data
// @markrendle 's proposal
dynamic manager; // To hold the aliased reference
var q = _db.Employees.Query()
.Join(_db.Employees.As("Manager"), out manager).On(manager.Id == _db.Employees.ManagerId)
.Select(_db.Employees.Name, manager.Name.As("Manager"));
// or this
var r= _db.Employees.Query( q => q
.Join( q.Managers = _db.Employees).On(q.Managers.Id == q.Employees.ManagerId)
.Select(q.Employees.Name,q.Manager.Name.As("Manager"))
@ToJans
ToJans / Domain.AR.cs
Created October 21, 2011 15:02
Scritchy preview - Scritchy attempts to remove all the plumbing from CQRS
namespace Example.Domain.Implementation
{
public class StockItem:Scritchy.CQRS.ScratchAR
{
int Count = 0;
public void AddItems(int Count)
{
Changes+= new Events.ItemsAdded { StockItemId = Id, Count = Count };
}
@ToJans
ToJans / 00 Old specs.txt
Created November 15, 2011 09:02
Uniqueness in CQRS
When a user registers with a unique username
Then that registration should be approved
Given a user registration with a certain username was approved
When a new user registers with the same username
Then that registration should be rejected
@ToJans
ToJans / Generated files.txt
Created December 1, 2011 16:44
Performance test using Scritchy file storage
01/12/2011 17:40 321.352.624 GLOBAL.msgs
01/12/2011 17:40 77.779.616 HEADER_TaskId_Tasks.1.msgs
01/12/2011 17:40 86.990.360 HEADER_TaskId_Tasks.2.msgs
01/12/2011 17:40 81.873.280 HEADER_TaskId_Tasks.3.msgs
01/12/2011 17:40 74.709.368 HEADER_TaskId_Tasks.4.msgs
5 bestand(en) 642.705.248 bytes
@ToJans
ToJans / getUserMedia.html
Created December 8, 2011 08:48 — forked from tomayac/getUserMedia.html
navigator.getUserMedia Test
<html>
<head>
<title>navigator.getUserMedia() Demo</title>
</head>
<body>
<h1>See yourself?</h1>
If your browser supports
<span style="font-family:monospace;">navigator.getUserMedia()</span>
you should see yourself below. If you don't see yourself, try
downloading the
@ToJans
ToJans / 1.essay.asm
Created December 18, 2011 11:55
Essay code samples
; com files are always loaded at 100h address
ORG 100h
start: ; make sure data segments and extra segments point
; to the same segment as the code, since this is a
; com app
MOV AX,CS
MOV DS,AX
MOV ES,AX
@ToJans
ToJans / 1.Room.cs
Created December 20, 2011 12:19
Scritchy now supports validation, convention = "Can"+commandname, this works both in the AR and in stateless handlers !
using Scritchy.Domain;
namespace AnotherChat.Domain
{
public class Room : AR
{
int UserCount = 0;
public void JoinRoom(string UserId)
{
@ToJans
ToJans / DomainAccount.cs
Created January 15, 2012 11:15
LazyAss CQRS
using System.Collections.Generic;
using MinimalisticCQRS.Infrastructure;
namespace MinimalisticCQRS.Domain
{
public class Account : AR
{
decimal Balance = 0;
bool IsEnabed = false;
public class ResourceGroup:AR
{
List<string> unprovisionedResources = new List<string>();
public void ProvisionGroup(string[] ResourceIds)
{
foreach (var id in ResourceIds)
{
Apply(new UnprovisionedResourceAllocated(this.Id, ResourceId));
}
@ToJans
ToJans / transaction.cs
Created January 23, 2012 21:45
uh oh, blommekes uses CQRS from now on #OverArchitecture /cc @yreynhout ;)
using MinimalisticCQRS.Infrastructure;
namespace Blommekes.Domain.Entities
{
public class Order : AR
{
private bool OrderClosed;
enum OrderStatus
{