Skip to content

Instantly share code, notes, and snippets.

View udidahan's full-sized avatar

Udi Dahan udidahan

View GitHub Profile
@udidahan
udidahan / events.js
Created September 21, 2015 11:50
Events where Udi and other people in Particular are presenting
$(function () {
var now = new Date().toJSON().slice(0,10);
var events=[];
$.ajax({
type: 'POST',
url: "https://www.googleapis.com/calendar/v3/calendars/[email protected]/events?orderBy=startTime&singleEvents=true&timeMin=" + now + "T00%3A00%3A00Z&key=AIzaSyDJ29Ux6xcsL-y4aaAjGbKzCnj-skBUUBk",
dataType: 'jsonp',
success: function (jData) {
for(var i = 0; i < jData.items.length; i++) {
@udidahan
udidahan / gist:8729522
Created January 31, 2014 10:13
Refund policy for product returns
public class RefundPolicy : Saga<RefundPolicy.State>, IAmStartedByMessages<OrderAccepted>, IHandleMessages<ProductsReturned>,
IHandleTimeouts<Percent>,
IHandleSagaNotFound
{
public void Handle(OrderAccepted message)
{
Data.OrderId = message.OrderId;
Data.Percent = 100;
RequestTimeout(TimeSpan.FromDays(30), 50.Percent());
@udidahan
udidahan / gist:3149693
Created July 20, 2012 08:50
Saga code from ADSD course in Israel
namespace Billing
{
public class RefundPolicyData : IContainSagaData
{
public Guid Id { get; set; }
public string Originator { get; set; }
public string OriginalMessageId { get; set; }
public Guid OrderId { get; set; }
@udidahan
udidahan / gist:854518
Created March 4, 2011 12:03
Udi Dahan ADSD refactoring
public class CC1 : IHandleMessages<MakeCustomerPreferred>
{
public IBus Bus { get; set; }
public void Handle(MakeCustomerPreferred message)
{
Bus.Publish<CustomerHasBeenMadePreferred>(m => m.CustomerId = message.CustomerId);
}
}