Skip to content

Instantly share code, notes, and snippets.

@sumeet
sumeet / find.py
Created July 11, 2010 17:47
Python find
import os
import re
def find(expression, path='.', type='df'):
"""
Find files or directories.
>>> list(find(r'.*\.py$', type='f'))
['./find.py']
"""
module FsJson
open System
open System.Text.RegularExpressions
type Json =
| JsonObject of JsonSlot list
| JsonString of String
| JsonNumber of float
| JsonBool of bool
| JsonNull
[TestMethod]
public void should_set_parameter()
{
var message = new Message() as dynamic;
message.Foo = "foo";
var foo = message.Foo as string;
foo.ShouldBe("foo");
}
@panesofglass
panesofglass / EnumerableExtensions.cs
Created November 5, 2009 16:22
ForEach extensions
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>
@panesofglass
panesofglass / Specification.cs
Created October 26, 2009 16:16
A generic specification base class.
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" />
@panesofglass
panesofglass / ISpecification.cs
Created October 26, 2009 16:14
Interface for the Specification pattern.
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>
@nkohari
nkohari / linq.js
Created September 26, 2009 20:13
linq.js
/*
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) {