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
[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 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
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 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 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 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
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 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
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 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
safeHead [] = Left "The list was empty. No head is available." | |
safeHead xs = Right . head $ xs | |
-- Sample usage from GHCI: | |
-- | |
-- *Safefs> safeHead [1..3] | |
-- Right 1 | |
-- *Safefs> safeHead [7] | |
-- Right 7 | |
-- *Safefs> safeHead [2, 3] |
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
module ApiModel where | |
import Data.Time (ZonedTime(..), parseTimeM, defaultTimeLocale, iso8601DateFormat) | |
data ReservationRendition = ReservationRendition | |
{ rDate :: String | |
, rName :: String | |
, rEmail :: String | |
, rQuantity :: Int } | |
deriving (Eq, Show, Read) |
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
module Tuple2 | |
let replicate x = x, x | |
let curry f x y = f (x, y) | |
let uncurry f (x, y) = f x y | |
let swap (x, y) = (y, x) |
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
module Main where | |
import Control.Monad.Eff (Eff) | |
import Data.Maybe (fromJust) | |
import Data.Tuple (Tuple(..)) | |
import Graphics.Canvas (CANVAS, Context2D, closePath, getCanvasElementById, | |
getContext2D, lineTo, moveTo, setLineWidth, strokePath) | |
import Math (cos, pi, sin) | |
import Partial.Unsafe (unsafePartial) | |
import Prelude (Unit, bind, discard, negate, void, ($), (*), (+), (-), (/), (<=)) |
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
open System | |
open System.Drawing | |
open System.Windows.Forms | |
// Create a form to display the graphics | |
let width, height = 500, 500 | |
let form = new Form(Width = width, Height = height) | |
let box = new PictureBox(BackColor = Color.White, Dock = DockStyle.Fill) | |
let image = new Bitmap(width, height) | |
let graphics = Graphics.FromImage(image) |
OlderNewer