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
type ApiControllerCustomization() = | |
let controllerSpecification = | |
{ new IRequestSpecification with | |
member this.IsSatisfiedBy request = | |
match request with | |
| :? Type as t when typeof<ApiController>.IsAssignableFrom t -> | |
true | |
| _ -> false } | |
interface ICustomization with |
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
[Theory] | |
[InlineAutoHostData(null)] | |
[InlineAutoHostData("")] | |
[InlineAutoHostData] | |
public void ExecuteUnknownInputCorrectlyInvokesOnUnknown(string unknownInput, Action dummyOnExit) | |
{ | |
var verified = false; | |
var sut = new InputParseCommand(dummyOnExit, i => verified = i == unknownInput); | |
sut.Execute(unknownInput); | |
Assert.True(verified); |
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
container.RegisterType<IMeal, Meal>( | |
new InjectionConstructor( | |
new ResolvedArrayParameter<ICourse>( | |
new ResolvedParameter<ICourse>("entrée"), | |
new ResolvedParameter<ICourse>("mainCourse"), | |
new ResolvedParameter<ICourse>("dessert")))); |
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
let nerdCapsToKebabCase (text : string) = | |
let charToString index c = | |
let s = c.ToString().ToLower() | |
match index, Char.IsUpper c with | |
| 0, _ -> s | |
| _, true -> "-" + s | |
| _ -> s | |
text |> Seq.mapi charToString |> String.concat "" |
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 ImmutableXYZ { | |
public ImmutableXYZ() : this("", 0, -1) { | |
} | |
private ImmutableXYZ(string abc, int def, int haha) | |
{ | |
this.abc = abc; | |
this.def = def; | |
this.haha = haha; | |
} |
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
{-# LANGUAGE DeriveFunctor #-} | |
module PollingConsumer where | |
import Data.Time.Clock | |
import Control.Monad.Trans.Free (Free, FreeF(..), liftF, runFree) | |
import Control.Concurrent (threadDelay) | |
import System.Random (getStdRandom, random, randomR) | |
import Text.Printf (printf) | |
-- "Types prevent typos" - https://twitter.com/hmemcpy/status/867647943108681728 |
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
-- Translation to Haskell of: | |
-- http://ccd-school.de/2017/06/stratified-design-over-layered-design | |
-- I've deliberately translated each method to a function, in order to show the | |
-- similarity. Some functions, like extractWords, are redundant (already built | |
-- in) or almost too simple to get their own function. | |
module Main where | |
import Data.List (partition) |
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; | |
public class Foo : IEnumerable<int> | |
{ | |
public IEnumerator<int> GetEnumerator() | |
{ | |
yield return 42; | |
yield return 1337; |
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 RadioCode where | |
import Control.Arrow | |
import Data.Char | |
import Data.List | |
import Data.Maybe | |
icao :: [(Char, String)] | |
icao = | |
(head &&& delete ',') |
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 System.Threading.Tasks; | |
namespace Ploeh.Samples.ChainOfResponsibility | |
{ | |
public class Maybe<T> | |
{ |
OlderNewer