Skip to content

Instantly share code, notes, and snippets.

View lolgab's full-sized avatar

Lorenzo Gabriele lolgab

  • San Demetrio Corone, Italy
View GitHub Profile
@lolgab
lolgab / README.md
Last active May 30, 2023 17:10
scalafmt Github Actions

scalafmt Github Actions

This Github Action runs scalafmt on every Pull Request and then pushes the changes as a new commit on the same branch right away. It runs only on the *.scala and *.sbt files that appear in the Pull Request diff.

This way you can focus on your code and forget about formatting!

@lolgab
lolgab / build.sc
Last active April 28, 2021 19:08
Mill build file with shared Cross project
import mill._
import mill.api.Loose
import mill.define.Target
import mill.scalajslib._
import mill.scalalib._
import mill.scalalib.api.CompilationResult
trait BaseModule extends ScalaModule {
def scalaVersion = T("3.0.0-RC3")
def scalaJSVersion = T("1.5.1")
@lolgab
lolgab / Native.scala
Created October 25, 2018 13:18
Test changing for loops with while loops.
import scalanative.native._
import stdlib.malloc
object implicits {
type MVect3 = CStruct3[Double, Double, Double]
type MutableBody = CStruct3[MVect3, MVect3, Double]
implicit class MVect3Ops(val ptr: Ptr[MVect3]) extends AnyVal {
def x: Double = !ptr._1
def y: Double = !ptr._2
@lolgab
lolgab / ScalaNativeNBodyMutable.scala
Created October 23, 2018 15:07
NBody Performance Test with using Scala Native CStrucs and malloc
import scalanative.native._
import stdlib.malloc
object implicits {
type MVect3 = CStruct3[Double, Double, Double]
type MutableBody = CStruct3[MVect3, MVect3, Double]
implicit class MVect3Ops(val ptr: Ptr[MVect3]) extends AnyVal {
def x: Double = !ptr._1
def y: Double = !ptr._2