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
/* | |
linq.js -- a simple LINQ implementation for javascript | |
Author: Nate Kohari <nate@enkari.com> | |
Copyright (C) 2009 Enkari, Ltd. | |
Released under the Apache 2.0 license (http://www.opensource.org/licenses/apache2.0.php) | |
*/ | |
Array.prototype.all = function(func) { | |
var result = true; | |
this.iterate(function(item) { |
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 Foundation.Specifications | |
{ | |
/// <summary> | |
/// Interface for a specification. | |
/// </summary> | |
/// <typeparam name="T">The type specified.</typeparam> | |
/// <seealso href="http://www.lostechies.com/blogs/chrismissal/archive/2009/09/10/using-the-specification-pattern-for-querying.aspx" /> | |
public interface ISpecification<T> | |
{ | |
/// <summary> |
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.Linq.Expressions; | |
namespace Foundation.Specifications | |
{ | |
/// <summary> | |
/// Defines an abstract class from which to create conditional specifications. | |
/// </summary> | |
/// <typeparam name="T">The type of entity used in the specification.</typeparam> | |
/// <seealso href="http://ubik.com.au/article/named/implementing_the_specification_pattern_with_linq" /> |
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.Generic; | |
using System.Linq; | |
namespace Foundation.Collections | |
{ | |
/// <summary> | |
/// Adds extension methods to the IEnumerable{T} interface. | |
/// </summary> |
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
[TestMethod] | |
public void should_set_parameter() | |
{ | |
var message = new Message() as dynamic; | |
message.Foo = "foo"; | |
var foo = message.Foo as string; | |
foo.ShouldBe("foo"); | |
} |
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
module FsJson | |
open System | |
open System.Text.RegularExpressions | |
type Json = | |
| JsonObject of JsonSlot list | |
| JsonString of String | |
| JsonNumber of float | |
| JsonBool of bool | |
| JsonNull |
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
import os | |
import re | |
def find(expression, path='.', type='df'): | |
""" | |
Find files or directories. | |
>>> list(find(r'.*\.py$', type='f')) | |
['./find.py'] | |
""" |