Skip to content

Instantly share code, notes, and snippets.

View ryansroberts's full-sized avatar

Ryan Roberts ryansroberts

View GitHub Profile
public class AsyncStreamCopier
{
public event EventHandler Completed;
private readonly Stream input;
private readonly Stream output;
private byte[] buffer = new byte[4096];
public AsyncStreamCopier(Stream input, Stream output)
//Root object, builds a webapi delegating handler
public static void BootstrapCache(this HttpConfiguration configuration,
Cache cache,
IEnumerable<CacheHandler.Rule> rules,
RewriteResponse rewriteResponse, //Delegates to clean up Func<Func< eye searing signatures
RewriteRequest rewriteRequest,
MonitorCacheOperation monitor,
Func<string,string> secrets)
@ryansroberts
ryansroberts / gist:7452037
Created November 13, 2013 16:33
Fuctional
var parser =
UntilOpenQuote
(RecChar('h')
(RecChar('t')
(RecChar('t')
(RecChar('p')
(RecChar(':')
(RecChar('/')
(RecChar('/')
(UntilCloseQuote
public class Mutations
{
readonly BrowserSession session;
public Mutations(BrowserSession session)
{
this.session = session;
}
public Action ClickOnAnElement(string css, int ms = 200)
@ryansroberts
ryansroberts / gist:6536853
Created September 12, 2013 12:57
Fuck you webdriver
private void AppDomain_UnhandledException(Object sender, UnhandledExceptionEventArgs e){
this.error = ((Exception)e.ExceptionObject).Message;
if(this.thread.IsAlive){
this.thread.Abort();
this.timerhotkey.Stop();
Thread.CurrentThread.Join();
}
}
public class ReorderSupportingResourcePart : Handles<Hypermedia.ReorderSupportingResourcePart>
{
static Register route = () => "supportingresources/{supportingresourceid}/reorderresourcepart/{partid}";
readonly IDocumentStore store;
public ReorderSupportingResourcePart(IDocumentStore store) { this.store = store; }
public HttpResponseMessage Post(string supportingresourceid, int partid, Hypermedia.ReorderSupportingResourcePart input)
{
public interface constants
{
int a { get; }
}
public class myconstants1 : constants
{
public int a { get { return 1; } }
}
public static class constants
{
public static readonly int somevalue;
public constants()
{
somevalue = 20;
}
}
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Web;
using MarkupProcessor.Model.Markup;
using Pathways.Features.Shared.DocumentAggregation;
using Pathways.Model;
using Raven.Abstractions.Indexing;
using Raven.Client.Connection;
public class ParseTextSpec_Bold_Italic_Subscript_superscript : with_hambledown
{
Because of = () => parsing(
@"
H1. Heading 1
text before se __strong emph__ Some after _emph_
H1. This section has superscript and subscript.
This is some content ^Superscript Text^ text after. ~Subscript Text~ this should be some text. -this is struck through-
H1. Thrid H1
{This should be a no break section}