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
void DoSomethingToNode(BindingNode node) | |
{ | |
switch (node) | |
{ | |
case<BindingLiteral> foo: | |
foo.LiteralText += "blah"; | |
break; | |
case<BindingNameReference> bar: | |
break; |
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
<!-- bindings.xml --> | |
<bind element="display">Html.DisplayFor(m=>@for, "@template")</bind> | |
<bind element="display">Html.DisplayFor(m=>@for)</bind> | |
<bind element="a">Html.ActionLink("child()", "@action", "@controller", new{"@route.*"}, new{"@*"})</bind> | |
<bind element="a">Html.ActionLink("child()", "@action", new{"@route.*"}, new{"@*"})</bind> | |
<!-- sample.spark --> | |
<display for="m.ShipTo"/> | |
<display for="m.ShipTo" template="smalladdr"/> | |
<display for="m.ShipTo" template="${bar}"/> |
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 Result App1(IDictionary<string, object> env) { | |
var request = new Request(env); | |
request.Logger.Info("Calling " + request.ScriptName); | |
return new Result( | |
200, | |
new Dictionary<string, object>{{"Content-Type","text/plain"}}, | |
new[]{"<p>You are looking at", request.ScriptName, "</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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using NUnit.Framework; | |
namespace FuncGist { | |
// signature exposed by middleware and app |
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
using System; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using NUnit.Framework; | |
namespace FuncGist { | |
public static class ObservableExtensions { | |
public static Task Subscribe<T>(this IObservable<T> observable, Action<T> 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 Examples { | |
public void Foo() { | |
// these vars are all IObservable<string> | |
var src1 = Obs.Unit("one"); | |
var src2 = Obs.Create( | |
new[] { "one", "two", "three" }); | |
var src3 = Obs.Create<string>(write => { | |
write("one"); |
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
using IBodyObservable = IObservable<Tuple< // body | |
ArraySegment<byte>, // data | |
Action, // delay | |
Action>>; //continuation | |
using BodyDelegate = Func< // body | |
Action< // next | |
ArraySegment<byte>, //data | |
Action, // continuation | |
bool>, // delayed |
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
using System; | |
using System.IO; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace ObsBody | |
{ | |
internal class Program |
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
using System.Net; | |
using System.Net.Sockets; | |
using System.Text; | |
using System.Web.Mvc; | |
namespace HeaderChecking.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
public ActionResult Index() |
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
// current delegate | |
Action /*cancel*/ BodyDelegate( | |
Action<ArraySegment<byte>, Action, bool> next, | |
Action<Exception> error, | |
Action complete); | |
// node-like delegate | |
void BodyDelegate( | |
Action<ArraySegment<byte>, bool> write, | |
Action<Action, bool> flush, |
OlderNewer