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
open System.Linq | |
let words = [ "I"; "am"; "a"; "dog"] | |
let aggSentence = words.Aggregate(fun sentence word -> word + " " + sentence) | |
let reduceSentence = words |> Seq.reduce (fun sentence word -> word + " " + sentence) | |
aggSentence = reduceSentence |
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
// different hashes because different Seq object instances | |
> hash ([|1;2;3|] |> Seq.ofArray);; | |
val it : int = 851672095 | |
> hash ([|1;2;3|] |> Seq.ofArray);; | |
val it : int = -1641179064 | |
// same hash because Seq.ofList is just returning the list cast to IEnumerable<'t> | |
> hash ([1;2;3] |> Seq.ofList);; | |
val it : int = 1956583134 |
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
open System | |
type Show = class | |
static member _resolve = Unchecked.defaultof<Show> | |
static member show (x : int) = sprintf "%d" x | |
static member show (x : uint32) = sprintf "%du" x | |
static member inline invoke x = | |
let inline call (_ : ^a, x : ^b) = |
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
#!/bin/sh | |
EXEC="exec " | |
FSHARPI_OPTIONS="" | |
if test x"$1" = x--debug; then | |
DEBUG=--debug | |
shift | |
fi | |
if test x"$1" = x--gdb; then |
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 text = document.getElementsByTagName('input')[1]; | |
let button = document.getElementsByTagName('button')[0]; | |
setInterval(function () { | |
text.value = "hi frank."; | |
text.dispatchEvent(new Event('change', {bubbles: true})); | |
button.click() | |
}, 10000); |
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
#source this from your .zshrc somehow | |
_fake() { | |
local cur | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
RESULTS=$(fake -s build --list 2>/dev/null | tail -n +2 | awk '{$1=$1};1') | |
COMPREPLY=($(compgen -W "$RESULTS" -- "$cur")) | |
} | |
complete -F _fake fake | |
compdef fake |
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 dutest | |
open Marten | |
open Npgsql | |
open System | |
open System.Reflection | |
open Marten | |
type Case1 = { id: Guid; thing: int; status: bool } | |
type Case2 = { id: Guid; butts: string; ``where``: DateTime } |
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
2lb top Sirloin | |
2/3 C vegetable oil | |
1/4 C soy sauce | |
3T honey | |
2T vinegar | |
1-1/2 tsp ginger | |
1 clove garlic, crushed | |
8oz mushrooms | |
Cube steak |
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 Types = | |
type BrowserCtx = | |
{ /// the actual unit of work | |
page : Page | |
dispose : unit -> unit | |
compareTimeout : System.TimeSpan | |
navigateTimeout : System.TimeSpan } | |
member x.CurrentUrl = x.page.Url | |
interface IDisposable with | |
member x.Dispose() = x.dispose() |
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
(* | |
Greed is a press-your-luck dice rolling game. In the game, the player rolls the dice and tries to earn as many points as possible from the result. | |
For the purposes of this kata, we will just be scoring a single roll of five dice (but see Extra Credit below). | |
Write a scoring method that calculates the best score based on a given roll using the following set of scoring rules. | |
Each die can only be scored once (so single die scores cannot be combined with triple die scores for the same individual die, but for instance four 5s could count as 1 Triple (500) and 1 Single (50) for a total of 550. | |
A single one (100 points) | |
A single five (50 points) | |
Triple ones [1,1,1] (1000 points) | |
Triple twos [2,2,2] (200 points) |