Skip to content

Instantly share code, notes, and snippets.

Ólafur Páll Geirsson olafurpg

Block or report user

Report or block olafurpg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View scala-7.5.json
{
"name": "Scala",
"scopeName": "source.scala",
"patterns": [
{
"include": "#code"
}
],
"repository": {
"block-comments": {
View scala-7.4.json
{
"name": "Scala",
"scopeName": "source.scala",
"patterns": [
{
"include": "#code"
}
],
"repository": {
"block-comments": {
View scala.diff
diff --git a/source.scala.json b/source.scala.json
index 1491594..9586413 100644
--- a/source.scala.json
+++ b/source.scala.json
@@ -16,7 +16,7 @@
"include": "#block-comments"
},
{
- "match": "(?x)\n\t\t\t(?! /\\*)\n\t\t\t(?! \\*/)\n\t\t "
+ "match": "(?x)(?! /\\*)(?! \\*/)"
View duplicate.txt
$ du -d 1 -h .bloop/metals/scala-2.12/
5.6M .bloop/metals/scala-2.12//classes-Metals-M5iIL4DpRmONiQGSyN7cBg==
6.2M .bloop/metals/scala-2.12//classes-Metals-mj-QLxr7SC-x5ibDTngLtA==
0B .bloop/metals/scala-2.12//classes-Metals-c7ff878c-cc1b-4163-a0bd-fec34668fcdc
5.7M .bloop/metals/scala-2.12//classes-Metals-A1BGn-d7Rj-L-PJUuDNJFw==
0B .bloop/metals/scala-2.12//test-classes
0B .bloop/metals/scala-2.12//classes-Metals-LYknN5FDSv-TS45oA-pgtw==
0B .bloop/metals/scala-2.12//classes-Metals-9681da1e-0cb0-4e50-88a0-d7d69cb4d7c3
6.2M .bloop/metals/scala-2.12//classes-Metals-FRG2WLmNRqSy5Rzb9yN-rg==
5.6M .bloop/metals/scala-2.12//classes-Metals-gw5fG5cfRcO_QdPlslko4Q==
@olafurpg
olafurpg / debug.sc
Last active May 31, 2019
Example using sourcecode and pprint to implement a `debug` function
View debug.sc
def debug[T](d: sourcecode.Text[T])(implicit tpe: pprint.TPrint[T], line: sourcecode.Line, file: sourcecode.File): Unit = {
println(s"${file.value}:${line.value} - ${d.source} ${tpe.render}: ${pprint.apply(d.value)}")
}
@main
def main(): Unit = {
val fooMatrix = List.fill(10)("foo").map(List.fill(10)(_))
debug(fooMatrix)
}
// debug.sc:8 - fooMatrix List[List[String]]: List(
@olafurpg
olafurpg / DownloadSources.scala
Last active May 24, 2019
Script to download all library sources into a target directory
View DownloadSources.scala
import sbt._, Keys._
object DownloadSources extends AutoPlugin {
override def trigger = allRequirements
override def requires = sbt.plugins.JvmPlugin
override def projectSettings =
List(Compile, Test).flatMap { config =>
inConfig(config)(
TaskKey[Seq[File]]("downloadSources") := Def.task[Seq[File]] {
val out = baseDirectory.in(ThisBuild).value / "target" / "sources"
View gist:221f895fe1449658e9c592d80559bd78
/Users/olafurpg/.ivy2/local/org.scalameta/mdoc_2.12
└── 1.2.10
├── ivys
│   ├── ivy.xml
│   ├── ivy.xml.md5
│   └── ivy.xml.sha1
├── jars
│   ├── mdoc_2.12.jar
│   ├── mdoc_2.12.jar.md5
│   └── mdoc_2.12.jar.sha1
View gist:1f5c3c0478dfedd0c311b6ff665c2b4c
2019-05-03 12:54:34
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.192-b12 mixed mode):
"RMI TCP Connection(idle)" #2773 daemon prio=9 os_prio=31 tid=0x00007fe168047000 nid=0x6a8b waiting on condition [0x000070000c989000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000006d8dc05e0> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
View foo.txt
[error] cannot link: @java.lang.ClassLoader::getResources_java.lang.String_java.util.Enumeration
[error] cannot link: @java.lang.StringBuilder::lastIndexOf_java.lang.String_i32
[error] cannot link: @java.lang.StringBuilder::lastIndexOf_java.lang.String_i32_i32
[error] cannot link: @java.lang.Thread::getContextClassLoader_java.lang.ClassLoader
[error] cannot link: @java.net.URI::toURL_java.net.URL
[error] cannot link: @java.net.URL::getPath_java.lang.String
[error] cannot link: @java.net.URL::getProtocol_java.lang.String
[error] cannot link: @java.net.URL::hashCode_i32
[error] cannot link: @java.net.URL::openConnection_java.net.URLConnection
[error] cannot link: @java.net.URL::toExternalForm_java.lang.String
View context.diff
diff --git a/src/compiler/target/a.txt b/src/compiler/target/a.txt
index 7f26b052a5..708caf09f4 100644
--- a/src/compiler/target/a.txt
+++ b/src/compiler/target/a.txt
@@ -26,162 +26,6 @@ scala.meta.internal.pc.MetalsGlobal#addContext:200 showCode(context.tree): """pa
})
}
}"""
-Scope{
- final package sun;
You can’t perform that action at this time.