This file contains hidden or 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
| // Pretend this is a LINQ to SQL entity | |
| public class Product | |
| { | |
| public string Name { get; private set; } | |
| public IEnumerable<ProductTranslation> Translations { get; private set; } | |
| public Product(string name, IEnumerable<ProductTranslation> translations) | |
| { | |
| Name = name; |
This file contains hidden or 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
| // Tiniest BDD DSL/framework around? | |
| // Licensed under MSPL/FreeBSD/ISC or any other OSS license you want | |
| // Original idea from http://blog.kjempekjekt.com/2009/08/13/ultra-tiny-given-when-then-dsl-snippet/, | |
| // turned into generic base class by Jonas Follesø. | |
| public abstract class BDD<T> where T : BDD<T> | |
| { | |
| protected T Given { get { return (T)this; } } | |
| protected T And { get { return (T)this; } } | |
| protected T When { get { return (T)this; } } |
This file contains hidden or 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
| require 'spec' | |
| class DocsToCode | |
| def initialize() | |
| puts "hello" | |
| end | |
| def docs_in(path) | |
| [] | |
| end | |
| def code_in(doc) |
This file contains hidden or 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
| require 'spec' | |
| class DocsToCode | |
| def docs_in(path) | |
| [] | |
| end | |
| def code_in(doc) | |
| "" | |
| end | |
| def extract(path) |
This file contains hidden or 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 Parallelizer | |
| { | |
| private int actionCount; | |
| private int completedActionsCount; | |
| private volatile bool allActionsCompleted; | |
| private ICollection<Exception> exceptions; | |
| public IEnumerable<Exception> Exceptions | |
| { | |
| get { return exceptions; } |
This file contains hidden or 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 Greeter | |
| def say_hello | |
| puts 'Hello World!' | |
| end | |
| end | |
| g1 = Greeter.new | |
| g2 = Greeter.new | |
| class << g2 | |
| def say_hello |
This file contains hidden or 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
| if (IsPostBack) | |
| { | |
| ModelEntity.EmailId = Convert.ToInt32(Request[ddlEmails.UniqueID + "$field"]); | |
| } |
This file contains hidden or 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
| // Original code - let's improve it... | |
| public bool IsTelephoneNumberInUse(int clientId, int telephoneId) | |
| { | |
| ISubscriptionService service = GetService<ISubscriptionService>(); | |
| IList<Subscription> subs = service.GetSubscriptions(clientId, false); | |
| bool inUse = false; | |
| foreach (Subscription sub in subs) { | |
| if (sub.ContactPhoneId == telephoneId) { | |
| inUse = true; |
This file contains hidden or 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
| prin·ci·ple/ˈprinsəpəl/Noun | |
| 1. A fundamental truth or proposition that serves as the foundation for a system of belief or behavior or for a chain of reasoning. | |
| 2. A rule or belief governing one's personal behavior. |
This file contains hidden or 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.IO; | |
| using Zippy.Chirp; | |
| using Zippy.Chirp.Engines; | |
| namespace Chirpy.ConsoleRedux | |
| { | |
| public class Program | |
| { | |
| public static void Main(string[] args) |
OlderNewer