Skip to content

Instantly share code, notes, and snippets.

Avatar

Ólafur Páll Geirsson olafurpg

View GitHub Profile
View ArtifactoryPlugin.scala
import sbt._
import sbt.Keys._
import sbt.plugins._
object ArtifactoryPlugin extends AutoPlugin {
override def trigger = allRequirements
override def requires = JvmPlugin && IvyPlugin
override val buildSettings = List(
commands += Command.command("publishArtifactory") { s =>
val newVersion = Project
View DecodingResult.scala
import mopt.internal.diagnostics.WithFilterDiagnostic
final case class ValueResult[+A](value: A) extends DecodingResult[A]
final case class ErrorResult(error: Diagnostic) extends DecodingResult[Nothing]
sealed abstract class DecodingResult[+A] extends Product with Serializable {
def get: A =
fold(identity, throw new NoSuchElementException())
def getOrElse[B >: A](other: => B): B =
View .zshrc
# cd without cd
setopt auto_cd
fpath=(~/.zsh/completion $fpath)
# Enable persistent history between shell sessions.
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory
View FileSuite.scala
package tests.imports
import tests.markdown.BaseMarkdownSuite
import tests.cli.BaseCliSuite
import scala.meta.io.RelativePath
class FileSuite extends BaseCliSuite {
val includeOutputPath: RelativePath => Boolean = { path => path.toNIO.endsWith("readme.md") }
checkCli(
View docstrings.scala
@ import $ivy.`org.scalameta:::mtags:0.8.4`, scala.meta.internal.mtags._, scala.meta.internal.metals._
iimport $ivy.$ , scala.meta.internal.mtags._, scala.meta.internal.metals._
@ import scala.collection.JavaConverters._
import scala.collection.JavaConverters._
@
val sources = coursierapi.Fetch.create().withClassifiers(Set("sources").asJava).addDependencies(coursierapi.Dependency.of("org.scala-lang", "scala-library", "2.13.2")).fetch().asScala.map(_.toPath).map(scala.meta.AbsolutePath(_))
sources: collection.mutable.Buffer[scala.meta.io.AbsolutePath] = ArrayBuffer(
@olafurpg
olafurpg / Nailgun.sh
Last active Apr 6, 2020
Fast edit/run feedback loop for Scala using Nailgun
View Nailgun.sh
# Step 1: install coursier and nailgun
brew install nailgun coursier/formulas/coursier
# Step 2: start nailgun server with the Scala compiler on the classpath
cs launch com.martiansoftware:nailgun-server:0.9.1 org.scala-lang:scala-compiler:2.13.1 --main com.martiansoftware.nailgun.NGServer -- 2113 &
# Step 3: create basic Scala hello world
echo 'println("Hello world!")' > Main.scala
# Step 4: assemble the classpath.
View gist:1c9f8953ac591e5541f61d1b79b40236
[[syntax trees at end of typer]] // foo.scala
package <empty> {
import com.twitter.scalding.serialization.RequiredBinaryComparators;
abstract trait MagicRecsNotificationsTrait extends com.twitter.scalding.Job with com.twitter.scalding.serialization.RequiredBinaryComparators {
def /*MagicRecsNotificationsTrait*/$init$(): Unit = {
()
};
<stable> <accessor> val aggregatedData: com.twitter.scalding.typed.TypedPipe[(Long, Option[Long])] = scala.Predef.???;
def infinite: com.twitter.scalding.typed.TypedPipe[(Long, Option[Long])] = MagicRecsNotificationsTrait.this.aggregatedData.distinct({
final class $anon extends com.twitter.scalding.serialization.macros.impl.ordered_serialization.runtime_helpers.MacroEqualityOrderedSerialization[(Long, Option[Long])] {
View gist:7b220197f82f8275b08d12e94921701d
diff --git a/metals/src/main/scala/scala/meta/internal/pantsbuild/BloopPants.scala b/metals/src/main/scala/scala/meta/internal/pantsbuild/BloopPants.scala
index 688deb9..fa369bd 100644
--- a/metals/src/main/scala/scala/meta/internal/pantsbuild/BloopPants.scala
+++ b/metals/src/main/scala/scala/meta/internal/pantsbuild/BloopPants.scala
@@ -605,19 +605,18 @@ private class BloopPants(
private def cleanStaleBloopFiles(
generatedProjects: collection.Set[Path]
): Unit = {
- val ls = Files.list(bloopDir)
- try {
View gist:bb1145266a14bdb0cecb847c8d1fb2b9
2020-01-28 16:20:03
Full thread dump TwitterJDK 64-Bit Server VM (25.222-b10-jvmci-0.30-Tw8r22b0 mixed mode):
"Attach Listener" #43 daemon prio=9 os_prio=31 tid=0x00007faf872be000 nid=0x9407 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"bloop-io-42" #42 daemon prio=5 os_prio=31 tid=0x00007faf37f34000 nid=0x7403 waiting on condition [0x0000700004e7a000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000005c000d320> (a java.util.concurrent.SynchronousQueue$TransferStack)
View gist:2991e1fa154f02afeda958609c72759e
2020-01-28 16:19:34
Full thread dump TwitterJDK 64-Bit Server VM (25.222-b10-jvmci-0.30-Tw8r22b0 mixed mode):
"Attach Listener" #73 daemon prio=9 os_prio=31 tid=0x00007f8a5401a800 nid=0x9807 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"NGSession 4: (idle)" #70 prio=5 os_prio=31 tid=0x00007f8ab6aed000 nid=0xa707 in Object.wait() [0x0000700002711000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0000000719e89040> (a java.lang.Object)