Skip to content

Instantly share code, notes, and snippets.

View hovsater's full-sized avatar
🤟

Kevin Hovsäter hovsater

🤟
View GitHub Profile
diff --git a/src/commands.c b/src/commands.c
index 63cb3606..61abb0c3 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -1113,10 +1113,12 @@ static bool cmd_open(EditorState *e, const CommandArgs *a)
paths = globbuf.gl_pathv;
}
+ bool replace_view = has_flag(a, 'R');
+
@hovsater
hovsater / Day06.elm
Created December 7, 2022 15:48
Solution to Advent of Code 2022, Day 6.
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.
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.
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.
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.
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.
module Day01 exposing (partOne, partTwo)
decreasingOrder : comparable -> comparable -> Order
decreasingOrder a b =
case compare a b of
LT ->
GT
EQ ->
EQ
function EditText<T extends React.ElementType = "h1">({
as: Component = "h1",
children
}: EditTextProps<T>) {
Component
return <Component>{children}</Component>;
}
function EditText<T extends React.ElementType = "h1">({
as,
children
}: EditTextProps<T>) {
const Component = as || "h1";
return <Component>{children}</Component>;
}
module Kata exposing (fromNb2Str)
fromNb2Str n modsys =
let
gcd : Int -> Int -> Int
gcd a b =
if b == 0 then
a