Skip to content

Instantly share code, notes, and snippets.

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CriticalDeviceDatabase\primary_ide_channel]
"ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
"Service"="atapi"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CriticalDeviceDatabase\secondary_ide_channel]
"ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
"Service"="atapi"
@tarao
tarao / builder.sc
Last active February 6, 2024 09:20
//> using dep "com.github.tarao::record4s:0.11.2"
import com.github.tarao.record4s.%
import com.github.tarao.record4s.typing.Record.Append
import scala.util.NotGiven as !
type NameField = %{ val name: String }
type AgeField = %{ val age: Int }
type OsField = %{ val os: String }
//> using dep "com.github.tarao::record4s::0.9.1"
//> using dep "org.getshaka::native-converter::0.9.0"
import scala.compiletime.{constValue, erasedValue, summonInline}
import scala.scalajs.js
import scala.util.NotGiven
import com.github.tarao.record4s.{%, ArrayRecord, RecordLike}
import org.getshaka.nativeconverter.{NativeConverter, ParseState}
@tarao
tarao / Item.scala
Last active December 15, 2023 05:53
package example.j5ik2o.dop.domain
import example.j5ik2o.common.domain.ItemType
import com.github.tarao.record4s.{%, Tag}
import java.net.URL
type Item = %{
val id: ItemId
val name: ItemName
@tarao
tarao / A.scala
Last active November 14, 2023 09:01
object A {
def hello(): Unit =
println("hello")
}
This file has been truncated, but you can view the full file.
[log typer] ==> recur(<empty>.type, a type that can be selected or applied)?
[log typer] ==> firstTry?
[log typer] <== firstTry = true
[log typer] <== recur(<empty>.type, a type that can be selected or applied) = true
[log typer] ==> recur(A.type, a type that can be selected or applied)?
[log typer] ==> firstTry?
[log typer] <== firstTry = true
[log typer] <== recur(A.type, a type that can be selected or applied) = true
[log typer] ==> recur(Map, AnyTypeConstructorProto)?
set noautofocus
let hintcharacters = "hjklgfdsayuioptrewq"
map ; :
map b :buffer<Space>
map J scrollPageDown
map K scrollPageUp
map <C-f> scrollFullPageDown
map <C-b> scrollFullPageUp
map d :execute gTx<CR>
map u lastClosedTab
@tarao
tarao / Main.scala
Last active March 10, 2022 09:36
A simple extensible record implementation in Scala 3
import record.Record
@main def main() = {
val r1 = Record.empty
println(util.showTypeOf(r1)) // record.Record
val r2 = r1 + ("name" -> "tarao")
println(util.showTypeOf(r2)) // record.Record { val name: String }
println(r2.name) // tarao
// println(r2.age)
import scala.compiletime.ops.{any, int}
trait Odd
object Odd {
type IsOdd[I <: Int] = any.!=[int.%[I, 2], 0]
def apply[I <: Int](i: I)(using IsOdd[I] =:= true): Int & Odd =
i.asInstanceOf[Int & Odd]
}
@tarao
tarao / Example.scala
Last active October 7, 2021 10:11
Scala 3.0.2 ClassCastException
object Example {
import scala.collection.IterableOps
import scala.language.implicitConversions
case class Cell[A](value: A)
object Cell {
implicit def toSeq[A, It[X] <: IterableOps[X, It, It[X]]](
cell: Cell[It[A]]
): Seq[A] = cell.value.to(Seq)
}