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; | |
using NUnit.Framework; | |
namespace DDD_1 | |
{ | |
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
ResourceSpace.Has.Resource<Home>() | |
/*(1)*/ .Map(_=>_.LastModified(r=>r.UpdateTime) | |
.Etag(r=>r.ID)) | |
/*(2)*/ .MapLastModified(_=>_.UpdateTime) | |
.MapEtag(r=>r.ID) | |
/*(3)*/ .Map().LastModified(_=>_.UpdateTime) | |
.Etag(_=>_.ID) |
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
static internal class ResponseExtensions | |
{ | |
public static string GetLinkValue(this WebResponse response, string rel) | |
{ | |
return (from header in response.Headers["Link"].Split(',') | |
let components = header.Split(';') | |
let uri = components[0] | |
where components.Any( | |
component => | |
Regex.IsMatch(component, |
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 IEnumerable<Dictionary<string, string>> ItemScope(this XDocument document, string schema, params string[] propertyNames) | |
{ | |
return from node in document.Document.Descendants() | |
where node.HAttr("itemtype") == schema | |
where node.HAttr("itemscope") == "itemscope" | |
select (from property in node.Descendants() | |
let propName = property.HAttr("itemprop") | |
where propertyNames.Contains(propName) | |
select property).ToDictionary(_=>_.HAttr("itemprop"), _=>_.Value); | |
} |
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
class Program | |
{ | |
private const string REL_RESTAURANT_LIST = "http://rest.aurant.org/restaurant-list"; | |
static void Main(string[] args) | |
{ | |
var restaurantHref = DiscoverRestaurantListUri(); | |
Console.WriteLine("Using " + restaurantHref); | |
var selectedRestaurant = SelectRestaurantUri(restaurantHref); |
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
1+1,2 | |
1.1+0.1,1.2 | |
1+-1,0 | |
-2+1,-1 | |
1+2+3,6 | |
2*3,6 | |
2*-3,-6 | |
2*3*4,24 | |
3+3*4,15 | |
(3+3)*4,24 |
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 Wireup | |
{ | |
public void DoWireup() | |
{ | |
var identity = new IdentityFormatter(); | |
var stringFormat = new FormattingStringFormatter(); | |
// that would normally get registered in your container or what not. | |
Selectors = new[] | |
{ |
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.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Nancy; | |
using Nancy.Owin; | |
using Nowin; |
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 cappedqueue : cappedcontext | |
{ | |
static object[] examples = | |
{ | |
new { members = new[] { 1, 2, 3, 4 }, cap = 3, expected = new[] { 2, 3, 4 } } | |
}; | |
public cappedqueue(int[] members, int cap) | |
{ |
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; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using MongoDB.Bson.Serialization.Attributes; |
OlderNewer