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
var viewModel = { | |
Name: ko.observable("Pete"), | |
Age: ko.observable(29), | |
Occupation: ko.observable("Developer") | |
}; | |
applyChangeTracking(viewModel); | |
viewModel.Occupation("Unemployed"); |
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
var getObjProperties = function (obj) { | |
var objProperties = []; | |
var val = ko.utils.unwrapObservable(obj); | |
if (val !== null && typeof val === 'object') { | |
for (var i in val) { | |
if (val.hasOwnProperty(i)) objProperties.push({ "name": i, "value": val[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
public class MyMiddleware | |
{ | |
public Func<IDictionary<string, object>, Task> GetAppFunc(Func<IDictionary<string, object>, Task> next) | |
{ | |
return (env) => { | |
// do stuff | |
await next(env); | |
// do more stuff | |
} | |
} |
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
ʃ.Route(ʅ => ʅ / "Hello" * Pipeline.Action<FirstComponent>() / ( | |
ʅ / "World" * Pipeline.Action<SecondComponent>() | |
| ʅ / "Foobar" * Pipeline.Action<ThirdComponent>())); |
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
if (routeData.Pipeline.Any()) | |
{ | |
IAppBuilder branch = builder.New(); | |
foreach (var middleware in routeData.Pipeline) | |
{ | |
branch.Use(middleware); | |
} | |
branch.Use(typeof(RedirectMiddleware), this.next); |
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 MailController : ApiController | |
{ | |
private readonly dynamic[] mail = | |
{ | |
new { Id = 1, Location = "Inbox", Subject = "value1" }, | |
new { Id = 2, Location = "Inbox", Subject = "value2" }, | |
new { Id = 3, Location = "Inbox", Subject = "value3" }, | |
new { Id = 4, Location = "Deleted", Subject = "value4" }, | |
new { Id = 5, Location = "Sent", Subject = "value5" } | |
}; |
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
CacheControlHeaderProvider = (request, cfg) => | |
{ | |
var matcher = new Regex("/Api/Notifications"); | |
if (matcher.IsMatch(request.RequestUri.ToString())) | |
{ | |
return null; | |
} | |
return new CacheControlHeaderValue | |
{ |
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 IndividualResult<T> { | |
public bool WasCalculated { get; set; } | |
public T Result { get; set; } | |
} | |
public class CalculatesThings { | |
private PropertyACalculator<AType> propertyACalculator; | |
private PropertyBCalculator<BType> propertyBCalculator; | |
private PropertyCCalculator<CType> propertyCCalculator; |
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
namespace OwinModulesHelloWorld | |
{ | |
public class Product | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public double Price { 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
this.Post["Products"] = _ => | |
{ | |
var product = _.Bind<Product>(); | |
_.StatusCode = 201; | |
return new { Message = string.Format("Received product {0}", product.Name) }; | |
}; |