Skip to content

Instantly share code, notes, and snippets.

View CJSmith-0141's full-sized avatar

CJ Smith CJSmith-0141

View GitHub Profile
@CJSmith-0141
CJSmith-0141 / Day7.scala
Created December 11, 2023 01:06
Aoc 2023 Day 7
package net.tazato
import cats.Eq
import cats.effect.*
import cats.syntax.all.*
import cats.parse.Parser as P
import cats.parse.Numbers.digits
import cats.parse.Rfc5234.{alpha, lf, wsp, octet}
object Day7 extends IOApp.Simple {
val input = io.Source.fromResource("day7.txt").mkString
@CJSmith-0141
CJSmith-0141 / Day6.scala
Created December 11, 2023 01:01
AoC 2023 Day 6
package net.tazato
import cats.*
import cats.data.NonEmptyList
import cats.effect.*
import cats.parse.Parser as P
import cats.parse.Numbers.digits
import cats.parse.Rfc5234.lf
import cats.parse.Rfc5234.wsp
import cats.syntax.all.*
@CJSmith-0141
CJSmith-0141 / Day5.scala
Last active December 7, 2023 21:17
AoC 2023 Day 5
package net.tazato
import cats.*
import cats.data.NonEmptyList
import cats.effect.*
import cats.parse.Parser as P
import cats.parse.Numbers.digits
import cats.parse.Rfc5234.lf
import cats.parse.Rfc5234.wsp
import cats.syntax.all.*
@CJSmith-0141
CJSmith-0141 / Day4.scala
Created December 4, 2023 16:25
AoC 2023 Day 4
package net.tazato
import cats.*
import cats.effect.*
import cats.syntax.all.*
import cats.parse.Parser as P
import cats.parse.Rfc5234.{digit, wsp}
import scala.collection.mutable
@CJSmith-0141
CJSmith-0141 / Day3.scala
Created December 4, 2023 01:29
AoC 2023 Day 3
package net.tazato
import cats.*
import cats.effect.*
import cats.syntax.all.*
object Day3 extends IOApp.Simple {
case class PartNumberCoordinate(xMin: Int, xMax: Int, y: Int)
case class PartNumber(partNumber: Int, coordinate: PartNumberCoordinate)
@CJSmith-0141
CJSmith-0141 / Day2.scala
Last active December 2, 2023 15:55
AoC 2023 Day 2
package net.tazato
import cats.*
import cats.data.NonEmptyList
import cats.effect.*
import cats.syntax.all.*
import cats.parse.*
import cats.derived.*
import cats.parse.Rfc5234.{alpha, digit, wsp}
import scala.io.BufferedSource
@CJSmith-0141
CJSmith-0141 / Day1.scala
Last active December 1, 2023 18:42
AoC 2023 Day 1
package net.tazato
import cats.effect.*
object Day1 extends IOApp.Simple {
private def eat(s: String): String = {
s.replaceAll("one", "o1e")
.replaceAll("two", "t2o")
.replaceAll("three", "t3e")
.replaceAll("four", "f4r")
.replaceAll("five", "f5e")
package com.example.routes
import cats.Applicative
import cats.effect.Concurrent
import cats.syntax.all.*
import org.http4s.*
import org.http4s.circe.{jsonEncoderOf, jsonOf}
import org.http4s.dsl.Http4sDsl
import org.typelevel.ci.CIString
import io.circe.generic.semiauto.*

Rust

Rust has been touted as the most loved programming language many years in a row according to respondents in the Stack Overflow Annual Developer Survey , and if you write a blog post without mentioning this you are potentially commiting a crime. But . . . why? What productive things are being done with Rust, right now? Where, exactly, does rust shine? Having tinkered with the language on-again and off-again, I think it clearly shines where its killer application of garbage-collection-less memory safety can shine. That brings us to . . .

WebAssembly (wasm)

WebAssembly. wasm. You've probably heard murmerings of it, things like "it's faster!" or "adoption is coming!". Wasm evangelists haven't won me over, but I am curious about it. Since rust can compile with wasm as a target, rust and wasm feel tied together in my brain. How unfortunate for them both.

Svelte

Svelte is a JavaScript framework without a virtual DOM. But it's actually not that at all, it's

// Import the WebAssembly memory at the top of the file.
import { memory } from "wasm-game-of-life/wasm_game_of_life_bg";
// . . .