Skip to content

Instantly share code, notes, and snippets.

@loudej
loudej / gist:2651684
Created May 10, 2012 07:29
run owin-sandbox
git clone https://github.com/owin/owin-sandbox.git
cd owin-sandbox
build start
(or simply)
git clone https://github.com/owin/owin-sandbox.git && owin-sandbox\build start
(then browse http://localhost:3001 and http://localhost:3002, etc)
@loudej
loudej / Application.shade
Created April 12, 2012 21:21
".shade" left-offset spark syntax
html
head
meta charset="utf-8"
title =ViewBag.Title
link href="~/Content/Site.css" rel="stylesheet" type="text/css"
script src="~/Scripts/jquery-1.5.1.min.js" type="text/javascript" |
script src="~/Scripts/modernizr-1.7.min.js" type="text/javascript" |
body div.page
header
#title h1 |My MVC Application
@loudej
loudej / Chunked.cs
Created January 27, 2012 11:04
Comparison of chunked middleware
using System;
using System.Collections.Generic;
using Gate.Owin;
using System.Text;
namespace Gate.Middleware
{
public static class Chunked
{
public static IAppBuilder UseChunked(this IAppBuilder builder)
@loudej
loudej / gist:1684468
Created January 26, 2012 19:15
BodyDelegate
// 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,
@loudej
loudej / HomeController.cs
Created November 14, 2011 18:37
asp.net does not actually support multiple same-named incoming headers
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Web.Mvc;
namespace HeaderChecking.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
@loudej
loudej / Program.cs
Created May 13, 2011 21:58
Larger example
using System;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ObsBody
{
internal class Program
@loudej
loudej / body.cs
Created May 13, 2011 18:08
IObservable body
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
@loudej
loudej / gist:771534
Created January 9, 2011 08:31
Making obs from stuff
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");
@loudej
loudej / ObservableExtensions.cs
Created December 28, 2010 07:59
observable + task
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) {
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