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
class Bus { | |
constructor() { | |
this.handlers = {}; | |
} | |
subscribe(type, handler) { | |
this.handlers[type] = (this.handlers[type] || []) | |
.concat(handler); | |
} |
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
[DataContract] public class SomethingHappened : Event | |
{ | |
[DataMember(Order = 1)] public readonly string Sku; | |
[DataMember(Order = 2)] public readonly string UPC; | |
[DataMember(Order = 3)] public readonly string Description; | |
public SomethingHappened(string sku, string upc, string description) | |
{ | |
Sku = sku; | |
UPC = upc; |
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 ValidationErrorsViewModel : IEnumerable<ValidationErrorViewModel> | |
{ | |
private readonly IEnumerable<ValidationErrorViewModel> errors; | |
public ValidationErrorsViewModel(ModelValidationResult model) | |
{ | |
errors = from error in model.Errors | |
from member in error.MemberNames | |
select new ValidationErrorViewModel(member, error.GetMessage); | |
} |
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
private static IEnumerable<string> AreYouSerious(UserPrincipal identity) | |
{ | |
var enumerator = identity.GetAuthorizationGroups().GetEnumerator(); | |
while (enumerator.MoveNext()) | |
{ | |
Principal authorizationGroup = null; | |
try | |
{ | |
authorizationGroup = enumerator.Current; |
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 RavenProfilerModule : NancyModule | |
{ | |
private readonly IEnumerable<IDocumentStore> documentStores; | |
public RavenProfilerModule(IEnumerable<IDocumentStore> documentStores) | |
: base("/_raven-profiler") | |
{ | |
this.documentStores = documentStores; | |
Get["/"] = p => | |
{ |
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 MyAccount{ | |
public string UserName{get;set;} | |
public Guid Id{get;set;} | |
public IEnumerable<MyBullShitClaimEntity> Claims{get;set;} | |
public int EPenisSize{get;set;} | |
} | |
public class MyUserIdentity : IUserIdentity { | |
public string UserName{get;set; } | |
public IEnumerable<string> Claims{get;set;} |
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
class window.Ajaxinator | |
constructor: (document) -> | |
@document = document | |
serialize = (form) -> | |
return if not form or form.nodeName isnt "FORM" | |
q = [] | |
i = form.elements.length - 1 | |
while i >= 0 | |
element = form.elements[i] |
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
<?xml version="1.0"?> | |
<configuration> | |
<configSections> | |
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> | |
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/> | |
</sectionGroup> | |
<section name="razor" type="Nancy.ViewEngines.Razor.RazorConfigurationSection, Nancy.ViewEngines.Razor"/> | |
</configSections> | |
<appSettings> | |
<add key="webPages:Enabled" value="false"/> |
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 CommandBinder : IModelBinder | |
{ | |
private readonly IEnumerable<ITypeConverter> typeConverters; | |
private readonly IEnumerable<IBodyDeserializer> bodyDeserializers; | |
private readonly IFieldNameConverter fieldNameConverter; | |
private readonly BindingDefaults defaults; | |
public CommandBinder( | |
IEnumerable<ITypeConverter> typeConverters, IEnumerable<IBodyDeserializer> bodyDeserializers, | |
IFieldNameConverter fieldNameConverter, BindingDefaults defaults) |
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 static class CriteriaExtensions | |
{ | |
public static string IsEqualTo(this string criteria) | |
{ | |
return String.Format("= '{0}'", criteria ?? string.Empty); | |
} | |
} |