This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package scala.tools.nsc; | |
import org.openjdk.jmh.annotations.*; | |
import java.lang.reflect.Proxy; | |
import java.util.*; | |
import java.util.concurrent.TimeUnit; | |
@BenchmarkMode(Mode.AverageTime) | |
@OutputTimeUnit(TimeUnit.NANOSECONDS) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> allClasses.map(x => (x, getAllInterfaces(x).length, getAllInterfaces(x))).filter(_._2 >= 8).sortBy(_._2).reverse.foreach(println) | |
(class scala.reflect.runtime.JavaUniverse,71,List(interface scala.reflect.runtime.JavaUniverseForce, interface scala.reflect.runtime.ReflectSetup, interface scala.reflect.runtime.SymbolTable, interface scala.reflect.internal.Names, interface scala.reflect.internal.Symbols, interface scala.reflect.internal.Types, interface scala.reflect.internal.Variances, interface scala.reflect.internal.Kinds, interface scala.reflect.internal.ExistentialsAndSkolems, interface scala.reflect.internal.FlagSets, interface scala.reflect.internal.Scopes, interface scala.reflect.internal.Mirrors, interface scala.reflect.internal.Definitions, interface scala.reflect.internal.Constants, interface scala.reflect.internal.BaseTypeSeqs, interface scala.reflect.internal.InfoTransformers, interface scala.reflect.internal.transform.Transforms, interface scala.reflect.internal.StdNames, interface scala.refl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package demo | |
import java.io.{File, PrintWriter, StringWriter} | |
import scala.annotation.nowarn | |
import scala.reflect.internal.Flags.STATIC | |
import scala.reflect.internal.util.ScalaClassLoader.URLClassLoader | |
import scala.tools.nsc.backend.jvm.AsmUtils | |
import scala.tools.nsc.{Global, Phase} | |
import scala.tools.nsc.plugins.{Plugin, PluginComponent} | |
import scala.tools.nsc.transform.TypingTransformers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tail local.sbt project/local.sbt | |
==> local.sbt <== | |
TaskKey[Unit]("printBillOfMaterials") := (Def.taskDyn { | |
val proj = thisProject.value | |
val filter = ScopeFilter(inProjects(proj.aggregate: _*)) | |
Def.task { | |
(updateSbtClassifiers.value :: update.all(filter).value.toList).flatMap(_.configurations).flatMap(_.modules).flatMap(_.artifacts).flatMap(_._1.url).distinct.foreach(println) | |
() | |
} | |
}).value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BSStrategy = { | |
version: 1, | |
displayName: "Kayo", | |
accepts: { | |
method: "predicateOnTab", | |
format: "%K LIKE[c] '*kayosports.com.au/*/*'", | |
args: ["URL"] | |
}, | |
toggle: function () { console.log("toggle"); document.querySelector('[aria-label="Toggle play/pause"]').click(); }, | |
pause: function () { console.log("pause") }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class covariant extends scala.annotation.StaticAnnotation with scala.annotation.TypeConstraint | |
object SetFactory { | |
def empty[K]: Set[K @covariant] = Set.empty[K @covariant] | |
} | |
class Client { | |
val x = if (true) Set("") else SetFactory.empty | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package demo.compat | |
import scala.collection.{GenIterableLike, mutable} | |
import scala.tools.nsc.plugins.{Plugin, PluginComponent} | |
import scala.tools.nsc.{Global, Phase, Settings} | |
object IteratorLinter { | |
def main(args: Array[String]): Unit = { | |
println("go!") | |
val g = new Global(new Settings) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl --silent --fail https://raw.githubusercontent.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css > /tmp/gh.css && ( | |
echo '<html><head><link rel="stylesheet" href="/tmp/gh.css"/><style>@page { size: A4 landscape; }</style> | |
</head><body><div class="markdown-body">' && \ | |
gh api repos/lightbend/scala-team/issues/188 -t '{{.body}}' | | |
gh api --field text=@- /markdown && \ | |
echo '</div></body></html>' \ | |
) > /tmp/out.html | |
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-gpu --headless --print-to-pdf-no-header --print-to-pdf=/tmp/out.pdf /tmp/out.html | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class M { | |
type AnyIterableOps[+A, Repr] = collection.IterableOps[A, Any, Repr] | |
def richMap[K, V, CC <: collection.MapOps[K, V, AnyIterableOps, CC]] = () | |
def foo(m: scala.collection.immutable.Map[String, String]): AnyIterableOps[(String, String), scala.collection.immutable.Map[String, String]] = m | |
richMap[Int, String, scala.collection.immutable.Map[Int, String]] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object FindCollectionReturningHofs extends App { | |
import scala.tools.nsc._ | |
val global = new Global(new Settings) | |
import global._ | |
import global.settings | |
settings.usejavacp.value = true | |
settings.embeddedDefaults(getClass.getClassLoader) |
NewerOlder