Skip to content

Instantly share code, notes, and snippets.

@tarao
tarao / nowindow.js
Last active June 6, 2024 02:40
WSL launcher with custom weston.ini
var args = [];
for (var i=0; i < WScript.Arguments.length; i++) {
args.push(WScript.Arguments(i));
}
var sh = new ActiveXObject('WScript.Shell');
sh.Run(args.join(' '), 0 /* hidden */);
sh = null
@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)?
[log typer] ==> firstTry?
@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)
}

OSS貢献を出力するワークフロー

  • issueを立てるとtarao/oss-contributionsを実行
    • issueタイトルにはfrom=YYYY-MM-DDto=YYYY-MM-DDを含むこと
    • issueのラベルにoss-contributionsをつけること
  • パラメータ
    • ORGANIZATION : ターゲットとなるOrganization
    • GITHUB_TOKEN : issueコメントをするためのトークン
  • OPEN_ACCESS_GITHUB_TOKEN : OSS貢献の情報を取得するためのトークン(内部情報引けないものが望ましい)