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 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
| 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
| 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 |
NewerOlder