Skip to content

Instantly share code, notes, and snippets.

@adriaanm
adriaanm / sam_streams.scala
Last active November 8, 2020 01:28
Playing with Java 8 Stream from Scala 2.11.5
// $ scala-2.11.5 -Xexperimental
// Original Java 8 version: http://winterbe.com/posts/2014/07/31/java8-stream-tutorial-examples/
scala> import java.util.{Arrays, List, ArrayList}
scala> import java.util.stream.{Stream, IntStream}
// List<String> myList = Arrays.asList("a1", "a2", "b1", "c2", "c1");
scala> val myList = Arrays.asList("a1", "a2", "b1", "c2", "c1")
### Added by Zinit's installer
if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then
print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f"
command mkdir -p "$HOME/.zinit" && command chmod g-rwX "$HOME/.zinit"
command git clone https://github.com/zdharma/zinit "$HOME/.zinit/bin" && \
print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \
print -P "%F{160}▓▒░ The clone has failed.%f%b"
fi
@adriaanm
adriaanm / nightly.sbt
Created December 11, 2016 19:13
How to use the latest Scala nightly build from your sbt build by @SethTisue
// originally by @SethTisue, see http://stackoverflow.com/questions/40622878/how-do-i-tell-sbt-to-use-a-nightly-build-of-scala-2-11-or-2-12/40622879#40622879
resolvers += "nightlies" at "https://scala-ci.typesafe.com/artifactory/scala-release-temp/"
scalaVersion := {
val propsUrl = new URL("https://scala-ci.typesafe.com/job/scala-2.12.x-integrate-bootstrap/lastSuccessfulBuild/artifact/jenkins.properties/*view*/")
val props = new java.util.Properties
props.load(propsUrl.openStream)
props.getProperty("version")
}
scalaBinaryVersion := "2.12"
Class empty result fromSpecific result newSpecificBuilder result withFilter result
AbstractSeq Iterable[A @scala.annotation.unchecked.uncheckedVariance] Iterable[A @scala.annotation.unchecked.uncheckedVariance] mutable.Builder[A @scala.annotation.unchecked.uncheckedVariance,Iterable[A @scala.annotation.unchecked.uncheckedVariance]] WithFilter[A,[]Seq[]]
StringView View[Char] View[Char] mutable.Builder[Char,View[Char]] WithFilter[Char,[]View[]]
IndexedSeqView View[A] View[A] mutable.Builder[A,View[A]] WithFilter[A,[]View[]]
IndexedSeq IndexedSeq[A] IndexedSeq[A] mutable.Builder[A,IndexedSeq[A]] WithFilter[A,[]IndexedSeq[]]
LinearSeq LinearSeq[A] LinearSeq[A] mutable.Builder[A,LinearSeq[A]] WithFilter[A,[]LinearSeq[]]
Seq Seq[A] Seq[A] mutable.Builder[A,Seq[A]] WithFilter[A,[]Seq[]]
SeqView View[A] View[A] mutable.Builde
@adriaanm
adriaanm / 2.12.7.md
Last active September 21, 2018 10:31

Main highlights of this release:

  • Add Scaladoc markdown tables (#6043)
  • Fix equality of WrappedArray.ofRef (for Spark, #7156)
  • Numerous compiler performance improvements (#7067, #6696, #7147)

Further highlights:

  • Improved Java 9+ support (#7089 ASM 6.2, #7240 Un-deprecate linesIterator)
  • Support @Repeatable Java annotations (#6846)
@adriaanm
adriaanm / para-namers.diff
Created May 8, 2018 13:54
macro paradise namers/expanders diff
--- /tmp/para-namers.scala 2018-05-08 15:52:02.000000000 +0200
+++ src/compiler/scala/tools/nsc/typechecker/MacroAnnotationNamers.scala 2018-05-08 15:52:32.000000000 +0200
@@ -1,28 +1,22 @@
-package org.scalamacros.paradise
-package typechecker
-
-trait Namers {
- self: AnalyzerPlugins =>
+package scala.tools.nsc.typechecker
1 scala.collection.mutable.ArrayBuilder.ofBoolean
1 scala.collection.mutable.BitSet
1 scala.collection.mutable.ImmutableSetAdaptor
1 scala.collection.mutable.LazyBuilder
1 scala.collection.mutable.LinkedHashMap
1 scala.collection.mutable.LinkedHashMap.DefaultKeySet
1 scala.collection.mutable.Map
1 scala.collection.mutable.ObservableBuffer
1 scala.collection.mutable.SortedSet
1 scala.collection.script

Keybase proof

I hereby claim:

  • I am adriaanm on github.
  • I am adriaanm (https://keybase.io/adriaanm) on keybase.
  • I have a public key whose fingerprint is 4EE7 D8D2 38DC BD7C 979B 4FE4 5332 268A EEFE A620

To claim this, I am signing this object:

@adriaanm
adriaanm / github-tabindex.js
Last active September 11, 2017 22:05
Suppress tabindex for file upload / markdown help on github comment #tampermonkey
// ==UserScript==
// @name Suppress tabindex for file upload / markdown help on github comment
// @namespace http://tampermonkey.net/
// @version 0.3
// @match https://github.com/*
// @require http://code.jquery.com/jquery-1.11.0.min.js
// ==/UserScript==
(function() {
'use strict';
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*