Skip to content

Instantly share code, notes, and snippets.

case class Meal(
starter: Option[String],
main: String,
drinks: Seq[String],
tip: Option[Int]
)
val meals = Seq(
Meal(
starter = Some("Zucchini Fritters"),
$ sbt run
[info] welcome to sbt 1.5.2 (AdoptOpenJDK Java 11.0.11)
[info] loading settings for project global-plugins from plugins.sbt ...
[info] loading global plugins from /Users/roberto_tyley/.sbt/1.0/plugins
[info] loading settings for project ophan-geoip-db-refresher-build from plugins.sbt ...
[info] loading project definition from /Users/roberto_tyley/code/ophan-geoip-db-refresher/project
[info] loading settings for project ophan-geoip-db-refresher from build.sbt ...
[info] set current project to geoip-db-refresher (in build file:/Users/roberto_tyley/code/ophan-geoip-db-refresher/)
[info] compiling 1 Scala source to /Users/roberto_tyley/code/ophan-geoip-db-refresher/target/scala-3.0.0/classes ...
[info] running ophan.geoip.db.refresher.CLIMain
@rtyley
rtyley / gist:ee31ee962be024a5f71fb1ff836f8d72
Created May 16, 2021 17:05
Code compiled with Scala 3.0.0 throws NoClassDefFoundError/ClassNotFoundException when tests run
[info] Setting Scala version to 2.13.5 on 1 projects.
[info] Reapplying settings...
[info] set current project to scala-2-vs-3-noclassdeffounderror (in build file:/home/roberto/development/scala-2-vs-3-NoClassDefFoundError/)
[info] ExampleSpec:
[info] using Java Compress library
[info] - should not throw java.lang.NoClassDefFoundError
[info] Run completed in 302 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
roberto@kind:~/development/scaladex/scaladex$ docker -v
Docker version 20.10.6, build 370c289
roberto@kind:~/development/scaladex/scaladex$ docker-machine -v
docker-machine version 0.16.0, build 702c267f
roberto@kind:~/development/scaladex/scaladex$ sbt
[info] welcome to sbt 1.4.6 (Ubuntu Java 11.0.10)
[info] loading global plugins from /home/roberto/.sbt/1.0/plugins
[info] loading settings for project scaladex-build from plugins.sbt ...
[info] loading project definition from /home/roberto/development/scaladex/scaladex/project
[info] compiling 2 Scala sources to /home/roberto/development/scaladex/scaladex/project/target/scala-2.12/sbt-1.0/classes ...
@rtyley
rtyley / AppOnlyAuthentication.scala
Created February 19, 2019 15:35
Hack to make twitter4s support Application-only ('bearer') authentication for higher quota limits
package com.danielasfregola.twitter4s
import java.net.URLEncoder
import akka.actor.ActorSystem
import akka.http.scaladsl.model.HttpRequest
import akka.http.scaladsl.model.headers._
import akka.stream.{ActorMaterializer, Materializer}
import com.danielasfregola.twitter4s
import com.danielasfregola.twitter4s.entities.{AccessToken, ConsumerToken}
$ sbt
[info] Loading global plugins from /home/roberto/.sbt/0.13/plugins
[info] Loading project definition from /home/roberto/guardian/marley/project
[info] Set current project to root (in build file:/home/roberto/guardian/marley/)
> release
[info] Starting release process off commit: d4f62deee5bb5dc8c10b741d2f0f069e90e48340
[info] Checking remote [origin] ...
[info] Setting scala version to 2.12.4
[info] Set current project to root (in build file:/home/roberto/guardian/marley/)
[info] Setting scala version to 2.11.12
@rtyley
rtyley / gist:5f9f832fabe2bdcfc2d561a36c29f993
Created February 9, 2018 10:37
Log of sbt-release - cross-build not being uploaded/released
$ sbt
[info] Loading global plugins from /home/roberto/.sbt/0.13/plugins
[info] Loading project definition from /home/roberto/guardian/marley/project
[info] Set current project to root (in build file:/home/roberto/guardian/marley/)
> release
[info] Starting release process off commit: 8aaa0454d4af2ae6ea610d1b540a166d022895c0
[info] Checking remote [origin] ...
[info] Setting scala version to 2.12.4
[info] Set current project to root (in build file:/home/roberto/guardian/marley/)
[info] Updating {file:/home/roberto/guardian/marley/}thriftExample...
/***************************************************
This is a library example for the MLX90614 Temp Sensor
Designed specifically to work with the MLX90614 sensors in the
adafruit shop
----> https://www.adafruit.com/products/1748
----> https://www.adafruit.com/products/1749
These sensors use I2C to communicate, 2 pins are required to
interface
/*
Analog Input
Demonstrates analog input by reading an analog sensor on analog pin 0 and
turning on and off a light emitting diode(LED) connected to digital pin 13.
The amount of time the LED will be on and off depends on
the value obtained by analogRead().
The circuit:
* Potentiometer attached to analog input 0
* center pin of the potentiometer to the analog pin
@rtyley
rtyley / Checkout
Created March 24, 2016 15:27
Jellyfish tracking
<!DOCTYPE html>
<html lang="en-GB">