Skip to content

Instantly share code, notes, and snippets.

Avatar
🤟

Kevin Hovsäter hovsater

🤟
View GitHub Profile
@hovsater
hovsater / Day06.elm
Created December 7, 2022 15:48
Solution to Advent of Code 2022, Day 6.
View Day06.elm
module Day06 exposing (partOne, partTwo)
import Set exposing (Set)
type alias Signal =
String
findStartOfPacketMarker : Int -> Signal -> Int
@hovsater
hovsater / Day05.elm
Created December 7, 2022 14:59
Solution to Advent of Code 2022, Day 5.
View Day05.elm
module Day05 exposing (partOne, partTwo)
import Dict exposing (Dict)
import List.Extra as List
type alias Crate =
Char
@hovsater
hovsater / Day04.elm
Last active December 4, 2022 08:45
Solution to Advent of Code 2022, Day 4.
View Day04.elm
module Day04 exposing (partOne, partTwo)
import Parser exposing ((|.), (|=), Parser, Step(..), int, loop, map, oneOf, run, spaces, succeed, symbol)
type alias Range =
( Int, Int )
type alias RangePair =
@hovsater
hovsater / Day03.elm
Created December 3, 2022 21:43
Solution to Advent of Code 2022, Day 3.
View Day03.elm
module Day03 exposing (partOne, partTwo)
import Set exposing (Set)
type alias ItemType =
Char
itemTypePriority : ItemType -> Int
@hovsater
hovsater / Day02.elm
Last active December 3, 2022 20:09
Solution to Advent of Code 2022, Day 2.
View Day02.elm
module Day02 exposing (partOne, partTwo)
type alias Score =
Int
type Outcome
= Win Score
| Draw Score
| Loss Score
@hovsater
hovsater / Day01.elm
Last active December 3, 2022 15:04
Solution to Advent of Code 2022, Day 1.
View Day01.elm
module Day01 exposing (partOne, partTwo)
decreasingOrder : comparable -> comparable -> Order
decreasingOrder a b =
case compare a b of
LT ->
GT
EQ ->
EQ
View fails.ts
function EditText<T extends React.ElementType = "h1">({
as: Component = "h1",
children
}: EditTextProps<T>) {
Component
return <Component>{children}</Component>;
}
View works.ts
function EditText<T extends React.ElementType = "h1">({
as,
children
}: EditTextProps<T>) {
const Component = as || "h1";
return <Component>{children}</Component>;
}
View Kata.elm
module Kata exposing (fromNb2Str)
fromNb2Str n modsys =
let
gcd : Int -> Int -> Int
gcd a b =
if b == 0 then
a
View invert-tree.elm
fold (\v l r -> Node v r l) Empty tree