Skip to content

Instantly share code, notes, and snippets.

View xt0rted's full-sized avatar
🐛
finding all the bugs

Brian Surowiec xt0rted

🐛
finding all the bugs
View GitHub Profile
@aaronpowell
aaronpowell / License.md
Created May 16, 2012 07:18
A useful exception for when you don't want to implement a feature yourself

The MIT License

Copyright (c) 2012 Aaron Powell

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWA

@hyrmn
hyrmn / EndToEndTests.cs
Created July 29, 2012 16:27
My incomplete but evolving understanding of CQRS
using System;
using System.Reflection;
using CommonDomain;
using CommonDomain.Core;
using CommonDomain.Persistence;
using CommonDomain.Persistence.EventStore;
using EventStore;
using EventStore.Dispatcher;
@SzymonPobiega
SzymonPobiega / gist:5220595
Last active April 25, 2024 17:19
DDD/CQRS/ES/Architecture videos

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
namespace TestinNancyWithOwinTesting
{
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Nancy;
using Nancy.Bootstrapper;
using Nancy.Testing;
using Owin;
using Microsoft.Owin.Testing;
@warappa
warappa / Bootstrap.cs
Last active December 22, 2015 00:19
A possible way of doing event-versioning with NEventStore and a custom Json.Net NEventStore-serializer.
public class EventStorageBootStrap
{
public static void BootStrap()
{
...
var eventStore = Wireup.Init()
...
.UsingNewtonsoftJsonSerialization(new VersionedEventSerializationBinder())
...
.Build();
@loudej
loudej / auth.md
Last active December 24, 2015 08:29

Auth flows

Okay! Here are the environment keys and flows that authentication middleware follow.

Any API you see on IAuthenticationManager, IOwinContext, IOwinRequest, IOwinResponse are only syntax sugar and utility code around these env keys and values.

SignIn and SignOut

Simplest cases first: the application wants to sign in or sign out the user.

@idosela
idosela / http-response-interceptor.js
Last active February 25, 2024 12:51
Sample code for ng-conf 2014
angular.module('myMdl', []).config(['$httpProvider', function($httpProvider) {
$httpProvider.responseInterceptors.push([
'$q', '$templateCache', 'activeProfile',
function($q, $templateCache, activeProfile) {
// Keep track which HTML templates have already been modified.
var modifiedTemplates = {};
// Tests if there are any keep/omit attributes.
var HAS_FLAGS_EXP = /data-(keep|omit)/;
@copypastedeveloper
copypastedeveloper / EventUpconverter
Created June 10, 2014 03:57
Automapper based Event Upconversion
public class EventUpconverter<TSource, TDestination> : IUpconvertEvents<TSource, TDestination>
where TSource : class,IEvent
where TDestination : class,IEvent
{
readonly IMappingEngine _mapper;
public EventUpconverter(IMappingEngine mapper)
{
_mapper = mapper;
}
pipelines.OnError += (ctx, exception) =>
{
ctx.Items.Add("OnErrorException", exception);
return null;
};
@kshnurov
kshnurov / jquery.photoswipe.js
Created February 23, 2015 23:37
PhotoSwipe: init from DOM using jQuery
(function( $ ) {
$.fn.photoswipe = function(options){
var galleries = [],
_options = options;
var init = function($this){
galleries = [];
$this.each(function(i, gallery){
galleries.push({
id: i,