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
| This example shows how to setup an environment running Rails 3 under 1.9.2 with a 'rails3' gem set. | |
| ∴ rvm update --head | |
| # ((Open a new shell)) or do 'rvm reload' | |
| # If you do not already have the ruby interpreter installed, install it: | |
| ∴ rvm install 1.9.2 | |
| # Switch to 1.9.2-head and gemset rails3, create if it doesn't exist. | |
| ∴ rvm --create use 1.9.2@rails3 |
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
| class stoploss { | |
| private Dictionary<Guid, decimal> fifteen = new Dictionary>Guid, decimal>() | |
| private Dictionary<Guid, decimal> thirty = new Dictionary>Guid, decimal>();; | |
| bool alive = true; | |
| decimal price | |
| Guid id; | |
| public stoploss(PositionAcquiredMessage m) { | |
| id = m.PositionId; | |
| } |
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 CustomJsonFormatter : JsonMediaTypeFormatter | |
| { | |
| public override Task WriteToStreamAsync(Type type, object value, System.IO.Stream writeStream, | |
| System.Net.Http.HttpContent content, System.Net.TransportContext transportContext) | |
| { | |
| var objectWithLinks = value as IResourceWithLinks; | |
| if (objectWithLinks != null) | |
| { | |
| objectWithLinks.Links = new[] { new Link { Rel = "Self", Href = "???" } }; | |
| } |
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 ResourceLinksActionFilterAttribute : ActionFilterAttribute | |
| { | |
| public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) | |
| { | |
| ResourceModel payload; | |
| if (actionExecutedContext.Response.TryGetContentValue<ResourceModel>(out payload)) | |
| { | |
| payload.BuildResourceLinks(actionExecutedContext.Request); | |
| } | |
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 ApiKeyAuthHandler : DelegatingHandler | |
| { | |
| private const string ApiKeySchemeName = "ApiKey"; | |
| private const string AuthResponseHeader = "WWW-Authenticate"; | |
| protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) | |
| { | |
| var authHeader = request.Headers.Authorization; | |
| if (authHeader != null && authHeader.Scheme == ApiKeySchemeName) |
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.Concurrent; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using System.Threading.Tasks.Dataflow; | |
| namespace TDFDemo | |
| { | |
| class Program | |
| { |
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 Newtonsoft.Json; | |
| using System; | |
| using System.Collections.Concurrent; | |
| using System.Collections.Generic; | |
| using System.ComponentModel.DataAnnotations; | |
| using System.Diagnostics.CodeAnalysis; | |
| using System.Dynamic; | |
| using System.Linq; | |
| using System.Linq.Expressions; | |
| using System.Net; |
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
| { | |
| "_links": { | |
| "self": [ | |
| { | |
| "href": "/orders/10" | |
| } | |
| ], | |
| "warehouse": [ | |
| { | |
| "href": "/warehouse/10" |
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 GetEventStoreRepository : IRepository | |
| { | |
| private const string EventClrTypeHeader = "EventClrTypeName"; | |
| private const string AggregateClrTypeHeader = "AggregateClrTypeName"; | |
| private const string CommitIdHeader = "CommitId"; | |
| private const int WritePageSize = 500; | |
| private const int ReadPageSize = 500; | |
| private readonly Func<Type, Guid, string> _aggregateIdToStreamName; |
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
| namespace Fabrik.Common.Net | |
| { | |
| /// <summary> | |
| /// RFC5988 Link relation types <see cref="http://www.iana.org/assignments/link-relations/link-relations.xml"/>. | |
| /// </summary> | |
| public static class LinkRelations | |
| { | |
| /// <summary> | |
| /// Refers to a resource that is the subject of the link's context. |
OlderNewer