Skip to content

Instantly share code, notes, and snippets.

@trepidacious
trepidacious / SetTheme.astro
Created September 7, 2023 16:43
Very rough theme select in Astro with view transitions, using TailwindCSS and daisyUI
---
interface Props {
lightColor: string;
darkColor: string;
}
const { lightColor, darkColor } = Astro.props;
---
<!-- Store the theme colors for scripts to use -->
@trepidacious
trepidacious / p4gcep-steam-deck.md
Created September 3, 2022 21:33
Installing Persona 4 Golden Community Enhancement Pack on Steam Deck

Installing Persona 4 Golden Community Enhancement Pack on Steam Deck

Many thanks to chieftex and saber_breaker88 on reddit for the post here. This gist just adds some more notes and updates to those instructions, this was followed successfully on 2021-09-03, some steps have been removed (e.g. with flatseal) since they were not needed at that point.

The instructions below seem quite long, but they don't actually take that long to run - about half the time is just getting CEP set up on Windows so we can copy the files over, the whole thing should be doable in half an hour to an hour.

  • On Windows, install P4G and go through the whole process of applying the mods you want, following instructions on p4g.cep.one. When this is complete, you should be able to run Persona with the mods successfully.
@trepidacious
trepidacious / code.py
Created February 2, 2021 21:57
Pico RGB keypad
import time
import board
import busio
import usb_hid
from adafruit_bus_device.i2c_device import I2CDevice
import adafruit_dotstar
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
sbt:tree-react root project> show antdApp/fullClasspath
[info] * Attributed(/Users/rebeam/Documents/GitHub/tree-react/antd-app/target/scala-2.13/classes)
[info] * Attributed(/Users/rebeam/Documents/GitHub/tree-react/tree-slinky-extra/target/scala-2.13/classes)
[info] * Attributed(/Users/rebeam/Documents/GitHub/tree-react/tree-slinky/target/scala-2.13/classes)
[info] * Attributed(/Users/rebeam/Documents/GitHub/tree-react/tree-core/js/target/scala-2.13/classes)
[info] * Attributed(/Users/rebeam/Documents/GitHub/tree-react/tree-ot/js/target/scala-2.13/classes)
[info] * Attributed(/Users/rebeam/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/eu/timepit/refined_sjs1_2.13/0.9.13/refined_sjs1_2.13-0.9.13.jar)
[info] * Attributed(/Users/rebeam/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/me/shadaj/slinky-web_sjs1_2.13/0.6.5/slinky-web_sjs1_2.13-0.6.5.jar)
[info] * Attributed(/Users/rebeam/.ivy2/local/org.scalablytyped/antd_sjs1_2.13/4.3.1-70f266/jars/antd_sjs1_2.13.jar)
[info] * Attributed(/Users/r
/**
* A Transaction can produce an effect and a result using STMOps. This represents
* an atomic operation performed using the STMOps, getting/setting data, etc.
* Using a wrapper allows for use of different effects, and serialisation.
*/
trait Transaction[A] {
def apply[F[_]: Monad](implicit stm: STMOps[F]): F[A]
def map[B](f: A => B): Transaction[B] = {
object Routes {
sealed trait Page
case class SearchPage(term: String) extends Page
val routerConfig = RouterConfigDsl[Page].buildConfig { dsl =>
import dsl._
def uriString(regex: String): RouteB[String] = new RouteB(regex, 1, g => Some(decodeURIComponent(g(0))), encodeURIComponent)
case Put(create) => State(s => {
// Id and revision for the new data we will create
val id = Id[A](Guid(s.deltaId.clientId, s.deltaId.clientDeltaId, WithinDeltaId(s.currentGuidId)))
val revision = Guid(s.deltaId.clientId, s.deltaId.clientDeltaId, WithinDeltaId(s.currentGuidId + 1))
// Make the data item
val createDIO = create(id.asInstanceOf[Id[U with A]])
// Remember to increment guid twice for the guid and revision we generated
val stateWithA: (StateData[U], A) = createDIO.foldMap(arrow).run(s.withNextGuidId.withNextGuidId).value
trait Delta[U, A] {
def apply(a: A): DeltaIO[U, A]
}
sealed trait DeltaIOA[U, A]
case class GetGuid[U]() extends DeltaIOA[U, Guid]
//case class GetId[U, T <: U]() extends DeltaIOA[U, Id[T]]
case class GetContext[U]() extends DeltaIOA[U, DeltaIOContext]
case class GetDeltaId[U]() extends DeltaIOA[U, DeltaId]
case class GetPRInt[U]() extends DeltaIOA[U, Int]
case class Id[+A](guid: Long)
sealed trait DeltaIOA[U, A]
case class GetId[U, T <: U]() extends DeltaIOA[U, Id[T]]
case class Put[U, T <: U](create: Id[T] => DeltaIO[U, T]) extends DeltaIOA[U, T]
class Widener[U, V <: U] {
type DIOU[A] = DeltaIOA[U, A]
type DIOV[A] = DeltaIOA[V, A]
def stringViewThing = ReactComponentB[String]("StringViewThing")
.render_P(s => <.div(s): ReactElement)
.configure(Reusability.shouldComponentUpdateWithOverlay)
.componentWillUnmount(_ => Callback{println("StringViewThing unmounted! Again!")})
.build
val streetView = cursorView[Unit, Street, StreetDelta, Unit]("StreetView") { c => {
val r = <.div(
^.paddingTop := "20px",
^.backgroundColor := MaterialColor.Amber.a100,