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 BoundUrl | |
{ | |
private static PropertyAccessor s_urlAccessor; | |
static BoundUrl() | |
{ | |
var type = typeof(Route).Assembly.GetType("System.Web.Routing.BoundUrl"); | |
var property = type.GetProperty("Url", BindingFlags.Instance | BindingFlags.Public); | |
s_urlAccessor = new PropertyAccessor(property); | |
} |
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
internal class DomainParser | |
{ | |
public DomainParser(string pattern) | |
{ | |
this.Pattern = pattern; | |
this.Segments = CaptureSegments(pattern); | |
string routePattern = pattern.Replace("://", "/").Replace('.', '/'); | |
this.m_parsedRoute = RouteParser.Parse(routePattern); |
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 static class ImmutableListExtensions | |
{ | |
public static ImmutableList<T> Filter<T>(this ImmutableList<T> source, Func<T, bool> predicate) | |
{ | |
if (source == null) throw new ArgumentNullException("source"); | |
if (predicate == null) throw new ArgumentNullException("predicate"); | |
if (source.IsEmpty) return source; | |
return ImmutableList<T>.Create(source.Where(predicate)); | |
} |
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 static class EventFactory | |
{ | |
public static Event<T> Create<T>(Expression<Func<T>> eventExpr) | |
{ | |
return new Event<T>(eventExpr); | |
} | |
} | |
public class Event<T> | |
{ |
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 static class EventFactory | |
{ | |
public static DelegateEvent<T> Create<T>(Expression<Func<T>> eventExpr) | |
{ | |
return new DelegateEvent<T>(eventExpr); | |
} | |
} | |
public class DelegateEvent<TDelegate> | |
{ |
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
private static RAMDirectory IndexBenchmark(String target, int topN) throws Exception { | |
System.gc(); | |
if (topN < 0) topN = Integer.MAX_VALUE; | |
RAMDirectory ramDir = new RAMDirectory(); | |
IndexWriter ramWriter = new IndexWriter(ramDir, new StandardAnalyzer()); | |
FileInputStream fstream = new FileInputStream("Content.txt"); | |
BufferedReader reader = new BufferedReader(new InputStreamReader(fstream)); | |
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 NHTest.Collections | |
{ | |
using System.Reflection; | |
using Iesi.Collections.Generic; | |
using NHibernate.Collection.Generic; | |
using NHibernate.Engine; | |
public class PersistentSetBase<TItem, TAbstractSet> : PersistentGenericSet<TItem> | |
where TAbstractSet : ISet<TItem> |
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.Text; | |
namespace SimpleTest.Tdd | |
{ | |
internal interface IConverter | |
{ | |
object Convert(List<string> values); |
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 SimpleConsole | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
class Program | |
{ | |
static void Main() |
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
#light | |
module Token | |
let rec private readToken inQuote tokenChars restChars = | |
let chars2Token chars = new string(chars |> Array.ofList |> Array.rev) | |
if inQuote then | |
match restChars with | |
| '\'' :: [] -> (chars2Token tokenChars, []) | |
| '\'' :: '-' :: cs -> (chars2Token tokenChars, '-' :: cs) |