This file contains hidden or 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 System.Collections.Generic; | |
| using System.Dynamic; | |
| using System.Linq.Expressions; | |
| using Microsoft.CSharp.RuntimeBinder; | |
| namespace Nancy | |
| { | |
| public class DynamicDictionary : DynamicObject, IEquatable<DynamicDictionary> | |
| { |
This file contains hidden or 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 AuthenticationInterceptor : IInterceptor | |
| { | |
| bool CanIntercept(IInvocation invocation) { return invocation.Method.GetCustomAttributes(true).Any(a => a is RequiresAuthenticationAttribute); } | |
| public void Intercept(IInvocation invocation) | |
| { | |
| if (!CanIntercept(invocation)) invocation.Proceed(); | |
| else | |
| { | |
| var module = invocation.InvocationTarget as NancyModule; |
This file contains hidden or 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 AccountHandler() | |
| { | |
| Get["/accounts/{id}"] = x => { return GetById(x.id); }; | |
| Get["/accounts"] = x => { return GetListing(); }; | |
| Post["/accounts", req => CanPost(req)] = x => { return CreateNewAccount(Request.Body.FromJson<NewAccountForm>()); }; | |
| } |
This file contains hidden or 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 (OpenRastaConfiguration.Manual) | |
| { | |
| ResourceSpace.Has.ResourcesOfType<RetailStream>() | |
| .AtUri("/streams/{id}").And.AtUri("/streams") | |
| .HandledBy<RetailStreamHandler>() | |
| .TranscodedBy<JsonRestCodec>().And.; | |
| ResourceSpace.Has.ResourcesOfType<RetailStreamListItem[]>() | |
| .AtUri("/streams") | |
| .HandledBy<RetailStreamHandler>() |
This file contains hidden or 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
| [Fact] | |
| public void cant_pass_base_class_to_function_dynamically() | |
| { | |
| dynamic handler = new MessageHandler(); | |
| IMessage message = new Message(); | |
| handler.Handle(message); | |
| } | |
| [Fact] | |
| public void can_pass_base_class_to_function_via_reflection() |
This file contains hidden or 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 System.Windows.Controls; | |
| using System.Windows.Media; | |
| using System.Windows.Threading; | |
| namespace Presentation.Helpers { | |
| public static class TreeViewitemFinder { | |
| public static TreeViewItem BringTreeViewItemIntoView(this TreeView treeView, TreeViewItemModel item) { | |
| if (item == null) return null; |
This file contains hidden or 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
| //Apply selector to a random subset of source of size count and return the results | |
| public static class ExtensionHelpers { | |
| public static IEnumerable<TOut> SelectRandom<TSource, TOut>(this IEnumerable<TSource> source, | |
| Func<TSource, TOut> selector, | |
| int count) { | |
| var rand = new Random((int) (DateTime.Now.Ticks % int.MaxValue)); | |
| for (var i = 0; i < count; i++) | |
| yield return selector(source.ElementAt(rand.Next(source.Count()))); | |
| } | |
| } |
This file contains hidden or 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
| // ==UserScript== | |
| // @author Chris | |
| // @co-author None | |
| // @name Timer | |
| // @namespace myTest | |
| // @description eRepublik Advanced Tools | |
| // @version 1.0.0 | |
| // @include * | |
| // @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js | |
| // ==/UserScript== |
This file contains hidden or 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
| 00000000000000000003 | |
| 5b406bc7-2f68-4e97-bfe2-75e179571b31;634163655158954274;Ncqrs.Eventing.Storage.NoDB.Tests.Fakes.CustomerCreatedEvent, Ncqrs.Eventing.Storage.NoDB.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null;1.0;adc02213-cde3-4eaf-942e-1ef4d5adb406;0;{ "Name": "Foo", "Age": 35} | |
| 59e9e60b-dba5-4b96-97a2-90ae64b17e48;634163655158974275;Ncqrs.Eventing.Storage.NoDB.Tests.Fakes.CustomerNameChanged, Ncqrs.Eventing.Storage.NoDB.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null;1.0;adc02213-cde3-4eaf-942e-1ef4d5adb406;1;{ "CustomerId": "adc02213-cde3-4eaf-942e-1ef4d5adb406", "NewName": "Name2"} | |
| df092cec-9857-4f6c-b6ff-32110ebc0d75;634163655158984276;Ncqrs.Eventing.Storage.NoDB.Tests.Fakes.CustomerNameChanged, Ncqrs.Eventing.Storage.NoDB.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null;1.0;adc02213-cde3-4eaf-942e-1ef4d5adb406;2;{ "CustomerId": "adc02213-cde3-4eaf-942e-1ef4d5adb406", "NewName": "Name3"} |
This file contains hidden or 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 abstract class DomainEventTestBase<T> : IEventHandler<T> where T : DomainEvent | |
| { | |
| protected T Result; | |
| protected InProcessEventBus DomainEventBus; | |
| #region IEventHandler<T> Members | |
| public void Handle(T evnt) | |
| { | |
| Result = evnt; |