Skip to content

Instantly share code, notes, and snippets.

View tkshill's full-sized avatar
♥️
Trying

Kirk Shillingford tkshill

♥️
Trying
View GitHub Profile
@tkshill
tkshill / fuzz_testing.elm
Created October 4, 2020 22:56
an example of fuzz testing custom union types in Elm
module Tests exposing (suite)
import Expect
import Fuzz exposing (Fuzzer)
import Pages.Quarto as Q exposing (Colour(..), Gamepiece, Pattern(..), Shape(..), Size(..))
import Test exposing (Test, describe, fuzz)
-- TESTS ON CALCULATING GAME WIN LOGIC
@tkshill
tkshill / Tests.elm
Last active November 8, 2020 19:52
An Elm implementation of the exercism.io challenge "Word Count" using Elm-Parser
module Tests exposing (tests)
import Dict
import Expect
import Test exposing (..)
import WordCount exposing (wordCount)
tests : Test
tests =
@tkshill
tkshill / DelayedGenerator.elm
Last active November 9, 2020 19:29
Mimicking Choice with Delayed Generators
module Main exposing (main)
-- Press a button to draw a random card.
--
-- Dependencies:
-- elm install elm/random
--
import Browser
import Html exposing (..)
@tkshill
tkshill / blog.md
Last active November 10, 2020 22:21
Advent Of Code 2020 - 25 Language Challenge

The Progenitors

  1. Lisp
  2. C
  3. Smalltalk
  4. Cobol
  5. Ada

The Bash bros

@tkshill
tkshill / blog.md
Last active November 17, 2020 21:25
The Lone(ly) Coder
At my job I code alone.
I have always coded alone.
Until now.
Now I code with friends.
Now I code with family.
I will never code alone again.
- An Ode to Open Source
@tkshill
tkshill / _medianarrow.scss
Created December 10, 2020 15:59
this file is fine... until i try to wrap the stuff in a media query
/* MEDIA: only screen and (max-width: 42em), handheld ENDMEDIA */
@media only screen and (max-width: 42em) {
#outer {
background: #fff;
font-size: 0.875em;
position: relative;
}
h1, h2, h3 {
word-break: break-all;
@tkshill
tkshill / Minesweeper.hs
Created April 19, 2021 00:48
Solving the exercism Minesweeper problem with Haskell
module Minesweeper (annotate) where
import Data.Char (intToDigit)
import Data.List.Split (chunksOf)
annotate :: [String] -> [String]
annotate [] = []
annotate [[]] = [[]]
annotate board =
toBoard $ zipWith toOutput flatboard $ bombCounts board
@tkshill
tkshill / wordle.elm
Created March 8, 2022 20:56
Wordle clone in Elm
module Main exposing (Model, Msg(..), init, main, subscriptions, update, view)
import Browser
import Debug exposing (log)
import Html exposing (Html, button, div, input, span, text)
import Html.Attributes exposing (class, placeholder, style, value)
import Html.Events exposing (onClick, onInput)
import List.Extra as Liste
import Task
import Time
@tkshill
tkshill / minesweeper.py
Created June 7, 2021 23:15
Python 3.10 with Typing and MyPy
from typing import NewType, Literal, Union, Tuple
# Our standard grid is a 2d array of cells that are either a mine
# or not a mine
Mine = Literal["Mine"]
NotAMine = Literal["NotAMine"]
Cell = Union[Mine, NotAMine]
Grid = list[list[Cell]]
# Our annotated grid is a 2d array of cells that are either the number
@tkshill
tkshill / connect_four.ts
Created October 20, 2022 14:25
connect four game logic implementation using js generators
// ------------ GAME LOGIC ----------
/*
You can go Here to run it
https://www.typescriptlang.org/play?target=99&jsx=0&pretty=true&useUnknownInCatchVariables=true&ssl=1&ssc=1&pln=161&pc=54#code/PTAEFpK7NBxAggWQKKgDIHk4EkDCEM0AUMQC4CeADgKagAKANgIYU0BOoAvKAEROsOmAHY1eoAD58BbdgBUA7gHte5anSSsARjQA8cgHzdQcyaGEBXRozW1QAISXN2AE2OaKO3TI4GA2gC6gaSUdggAxmQAlgBuNADKZMxkdDwA3qBkFuzCAFwMLLIANKAA5swAtjSOzi75Na6gAL62dHhKFVSMNCmJyamgGQpRwqLs+R5ePuwGJeVVDXUOTo0toXR9KcYR0XGbdFLtnd29SSkh6gxKAM5R0UrCxn6WFTrsJS9vAa2gR1pKT3oNzuUQeJSBt3uwnBwKhMMhoOE31I4Qe1zIv0w6AAqkgAHLxYwAdmIqOE6NAACVMAB1Qk8ABspFJaIxIxBzEYi3qKzcXGIoEFoD8ADoxQh2OxWAAKPBY3EEgCUARFFWYVGlAH1uEYJVKKNLqXTFSKAGZRazSyzWRWKlGs0Ds6Kc-b5HaxBJnVICoUZLI5fL8QpCUS8OaVaq8-JOqKcxbNZkgUCcxigKiwxHXR2PZigGKcqJuVGvAEVCwUgAWzDioFRjAsFXJoB0ZAUNBojwADMnhG4GT23OwlAosy22x3QN3mL3QABWFnktnXABqBZcEJBD2M0r8dYb0NAQ4UAXyG6hip1PsFe8boF0mJx+MJADJn7WlPXbwYeN3X4fh6A36TqAf5HneVK0vEzJkhS6YIg8chKECKTCM6jB-Dc267h++4lEeJ5XPBwgXlwBhXqAO7kUKwrYZ+B74SUtG4f+CgQKAACMASMTe9EAeAoAAExccKPF4XxoAAMwBMJ1GybJSZxOw