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 log4net; | |
using PostSharp.Laos; | |
// http://exceptionalcode.wordpress.com/2010/02/17/centralizing-vsto-add-in-exception-management-with-postsharp/ | |
namespace Helpers.Vsto.ErrorHandling | |
{ | |
[Serializable] | |
public sealed class ExecutionEntryPointAttribute : OnExceptionAspect |
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
//Customer is an aggregate root | |
public class Customer : AggregateRootMappedByConvention | |
{ | |
//Customer contains orders, each of which is uniquely identified hence is an entity | |
private readonly List<Order> _orders = new List<Order>(); | |
public void CreateOrder(int id) | |
{ | |
//Does not create an entity, only publishes event. | |
//The entity has localy unique id. Its uniqueness is ensured here. |
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; | |
namespace CG2.ExamplePOC | |
{ | |
public class WithDrawCashContext : WithDrawCashHandler | |
{ | |
protected Guid CardId = Guid.NewGuid(); | |
protected Guid AccountId = Guid.NewGuid(); | |
protected Guid AtmId = Guid.NewGuid(); | |
} |
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 Order : AggregateRoot | |
{ | |
private readonly List<OrderItem> orderItems = new List<OrderItem>(); | |
public void UpdateOrderItem(Guid orderItemId, int quantity) | |
{ | |
var orderItem = orderItems.Where(q => q.EntityId == | |
orderItemId).FirstOrDefault(); | |
if (orderItem == null) |
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
<!-- Add to the package layout (via local.xml or however you prefer) --> | |
<!-- Also, best to remove before deployment, as some users report --> | |
<!-- it makes IE 7 crash --> | |
<default> | |
<reference name="content"> | |
<block type="core/text" name="fix.console" as="fix.console"> | |
<action method="setText"> | |
<text><![CDATA[<script type="text/javascript"> | |
iframe = document.createElement('iframe'); | |
iframe.style.display = 'none'; |
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
<?php | |
$start = microtime(true); | |
$fpIn = fopen('input.csv', 'r'); | |
$fpOut = fopen('output-pure.csv', 'w'); | |
while (($row = fgets($fpIn)) !== false) | |
{ | |
$fields = explode(";", $row); | |
fwrite($fpOut, |
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
// snippet is for http://abdullin.com/journal/2011/6/26/event-sourcing-a-la-lokad.html | |
// simple helper, that looks up and calls the proper overload of | |
// When(SpecificEventType event). Reflection information is cached statically | |
// once per type. | |
public static class RedirectToWhen | |
{ | |
static class Cache<T> | |
{ | |
public static readonly IDictionary<Type, MethodInfo> Dict = typeof(T) |
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
/// <summary> | |
/// Creates convention-based routing rules | |
/// </summary> | |
public sealed class RedirectToDynamicCommand | |
{ | |
readonly IDictionary<Type, Wire> _dict = new Dictionary<Type, Wire>(); | |
sealed class Wire | |
{ | |
public MethodInfo Method; |
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
internal class PublishingAtomicWriter<TKey, TEntity> : IAtomicWriter<TKey, TEntity> where TEntity : class | |
{ | |
private readonly IClientNotificationService _clients; | |
private readonly IAtomicWriter<TKey, TEntity> _writer; | |
private readonly Action<TKey, TEntity> _publishAction; | |
public PublishingAtomicWriter(IAtomicWriter<TKey, TEntity> writer, Action<TKey, TEntity> publishAction) | |
{ | |
if (publishAction == null) throw new ArgumentNullException("publishAction"); |
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
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
OlderNewer