Skip to content

Instantly share code, notes, and snippets.

View ignasi35's full-sized avatar
🚧
Breaking CI builds since 2001

Ignasi Marimon-Clos ignasi35

🚧
Breaking CI builds since 2001
View GitHub Profile
/*
* Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com>
*/
package play.api
import java.util.concurrent.atomic.AtomicReference
import akka.Done
import akka.actor.CoordinatedShutdown
@ignasi35
ignasi35 / ThinCake.scala
Created May 16, 2018 09:54
Thin cake deprecation alternatives
trait ACompo {
@deprecated("foo", "1.1")
def foo: String
}
trait BCompo {
def foo: String
}
trait CCompo {
// @deprecated("foo", "1.1")
@ignasi35
ignasi35 / AkkaHttpServer.patch
Created May 9, 2018 10:38
Moving Play's AkkaHttpServer#stop to CoordinatedShutdown
diff --git a/framework/src/play-akka-http-server/src/main/scala/play/core/server/AkkaHttpServer.scala b/framework/src/play-akka-http-server/src/main/scala/play/core/server/AkkaHttpServer.scala
index d4f495c35..b5aca371b 100644
--- a/framework/src/play-akka-http-server/src/main/scala/play/core/server/AkkaHttpServer.scala
+++ b/framework/src/play-akka-http-server/src/main/scala/play/core/server/AkkaHttpServer.scala
@@ -6,12 +6,13 @@ package play.core.server
import java.net.InetSocketAddress
import java.security.{ Provider, SecureRandom }
-import javax.net.ssl._
@ignasi35
ignasi35 / changelog.sh
Last active July 6, 2017 14:55
Some bash magic to generate the changelogs for lagom.
# Change Dir (cd) into the branch you want to release.
# Set the value of "TAG='1.3.5'" to the latest tag in the branch you are releasing
# The script uses `git log --pretty=format:"" START_HASH..HEAD` to list all commits between the $TAG and HEAD
# The $TAG is converted into a HASH ID using `git show-ref --tags -d | grep "tags/$TAG^"\| awk -F\ '{print $1}'`
# Of the returned log messages we grep to keep only those that include "(#999)" via `grep "(#"`
# The output looks like:
# Warn when describeServices is overridden (#847) Tim Moore
# Fix typo (#845) Yuliana Apaza
# Update sbt-conductr version to 2.3.5 in docs (#843) Ignasi Marimon-Clos
# Travis injects values using env vars, not system props (#838) Ignasi Marimon-Clos
@ignasi35
ignasi35 / playjsonformat.scala
Created January 25, 2017 15:49
An IntelliJ IDE live template to create a companion object with a Play Json formatter.
object $TYPE$ {
implicit val format: Format[$TYPE$] = Json.format
}
@ignasi35
ignasi35 / SlackService.scala
Last active January 4, 2019 18:05
A PoC client for Slack's "Custom Integrations" implemented as a Lagom Service.
package com.example.hello.api
import akka.NotUsed
import com.example.hello.api.SlackCustomIntegration.Message
import com.lightbend.lagom.scaladsl.api.{Descriptor, Service, ServiceCall}
import com.lightbend.lagom.scaladsl.api.Service._
import com.lightbend.lagom.scaladsl.api.transport.Method
import play.api.libs.json._
import play.api.libs.functional.syntax._
@ignasi35
ignasi35 / ironhack-meetup-samples.scala
Created April 14, 2016 20:39
Sample code for the Ironhack Meetup: Intro to scala for Ruby devs
package com.marimon.meetup
object Naive extends App {
def parse(s: String): Int = s.toInt
def div(in: Int): Int = 16 / in
def sqrt(in: Int): Double = Math.sqrt(in)
val values = List("4", "2", "-4", "0", "asdf")
package com.marimon.meetup
import com.marimon.meetup.providers._
import com.marimon.meetup.providers.MyBookStoreProtocol.cdFormat
import spray.routing.SimpleRoutingApp
import spray.httpx.SprayJsonSupport._
import com.marimon.meetup.providers.MyBookStoreProtocol._
object Main extends App with SimpleRoutingApp {
val u2 = Group("U2", Some(List(Person("Bono"), Person("TheEdge"))))
@ignasi35
ignasi35 / samples.scala
Created November 24, 2015 22:06
Betabeers Nov 2015 - Intro to scala
package com.marimon
case class Address(streetName: String,
number: Int,
zipCode: String,
city: String)
case class Person(name: String,
surname: String,
address: Option[Address])