Skip to content

Instantly share code, notes, and snippets.

@ajrnz
ajrnz / Macro.scala
Created February 28, 2021 11:21
Macro Testing (macro)
package ajr.scala3test
import scala.quoted.*
import upickle.default.Writer
def callImpl(obj: Expr[MyObject], argsExpr: Expr[Seq[Any]])(using Quotes): Expr[String] =
import quotes.reflect.report
argsExpr match
case Varargs(argExprs) =>
@ajrnz
ajrnz / Test.scala
Created February 28, 2021 11:21
Macro Testing
package ajr.scala3test
import upickle.default.{macroRW, readwriter, ReadWriter => RW, Writer}
abstract class MyObject:
val ref: String
inline def macroCall(inline args: Any*): String = ${ callImpl('this, 'args) }
class Thing(val ref: String) extends MyObject:
def something(i: Int, d: Double, s: String) = macroCall(i: Int, d: Double, s: String) // Why do I need the types here?
@ajrnz
ajrnz / LocalRepoPublish
Last active November 29, 2019 11:30
Skeleton for publishing to a local repo
trait CommonPublishModule extends LocalRepoPublishModule {
def sonatypeUri: String = "http://artifactory.mysite.dev/artifactory/libs-release/"
def publishVersion = "0.9.9"
... etc ...
}
import mill.define.{ExternalModule, Task}
import mill.api.PathRef
import mill.scalalib.publish.Artifact
@ajrnz
ajrnz / gist:f455a9f7468874e1657750478bda3fe7
Created July 18, 2018 15:40
Git commit stats by author
git log --all --numstat --pretty="%H" --author="Andrew Richards" --since=1.year|egrep -v "\\.(classpath|project|xml)\\}?$" | awk 'NF==3 {plus+=$1; minus+=$2} NF==1 {total++} END {printf("lines added: +%d\nlines deleted: -%d\ntotal commits: %d\n", plus, minus, total)}'
@ajrnz
ajrnz / keybase.md
Last active December 2, 2016 13:47
keybase.io verification

Keybase proof

I hereby claim:

  • I am ajrnz on github.
  • I am ajrnz (https://keybase.io/ajrnz) on keybase.
  • I have a public key whose fingerprint is C71F 2F8C 28A6 9BF9 1EFE 1541 3CF9 8F99 CE43 F27A

To claim this, I am signing this object: