Skip to content

Instantly share code, notes, and snippets.

export SCALA_VERSION=2.10.2
sudo echo "SCALA_HOME=/usr/local/scala/scala-${SCALA_VERSION}" > /etc/profile.d/scala.sh
sudo echo 'export SCALA_HOME' >> /etc/profile.d/scala.sh
sudo mkdir -p /usr/local/scala
sudo -s cp scala-${SCALA_VERSION}.tgz /usr/local/scala/
cd /usr/local/scala/
sudo -s tar xvf scala-${SCALA_VERSION}.tgz --no-same-owner
sudo rm -f scala-${SCALA_VERSION}.tgz
sudo chown -R root:root /usr/local/scala

JDK 8 Released

Most of us won’t be able to use/deploy JDK 8 in production for a looong time. But that shouldn’t stop us from using it, right?

It should be possible to sneak in JDK 8 in the back way, the same way we snuck in Groovy and other libraries we wanted to use.

The Test Suite to the rescue

The Maven compiler plugin run in two separate lifecycles, compile and testCompile. Those can be configured separately.

package connection
import java.net.InetSocketAddress
import java.security.{SecureRandom, KeyStore}
import javax.net.ssl.{TrustManagerFactory, KeyManagerFactory, SSLContext}
import akka.actor.Actor.Receive
import akka.stream.FlowMaterializer
import akka.stream.actor.ActorPublisherMessage.Request
import akka.stream.actor.ActorSubscriberMessage.{OnComplete, OnNext}
@solverit
solverit / ants.clj
Last active August 29, 2015 14:18 — forked from michiakig/ants.clj
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;dimensions of square world
#![feature(phase)]
#[phase(plugin, link)] extern crate log;
extern crate green;
extern crate rustuv;
use std::io;
use std::os;
use std::io::{Listener,Acceptor,TcpStream};
#[start]
import scala.util.Try
import scala.util.Success
import scala.util.Failure
db.run(myAction.asTry).map {result =>
result match {
case Success(res) => DBResult(DBStatus.Success, res)
case Failure(e: MySQLIntegrityConstraintViolationException) => {
//code: 1062, status: 23000, e: Duplicate entry 'foo' for key 'name'
import akka.actor.IO._
import akka.actor.{Props, IO, IOManager, Actor, ActorSystem}
import akka.event.Logging
import akka.util.ByteString
import java.net.InetSocketAddress
class TCPEchoServer(port: Int) extends Actor {
val log = Logging(context.system, this)
val state = IterateeRef.Map.async[IO.Handle]()(context.dispatcher)
@solverit
solverit / ImplicitSenderTest.scala
Last active September 11, 2015 22:38 — forked from mguillermin/ImplicitSenderTest.scala
Sample showing basic usage of Akka TestKit and TestActorRef
package sample.akka.testkit
import akka.actor.ActorSystem
import akka.actor.Actor
import akka.testkit.{TestKit, TestActorRef}
import org.scalatest.matchers.MustMatchers
import org.scalatest.WordSpec
class ImplicitSenderTest extends TestKit(ActorSystem("testSystem"))
// Using the ImplicitSender trait will automatically set `testActor` as the sender
@solverit
solverit / deploy
Last active June 12, 2016 13:11 — forked from JMBattista/install_gradle
Upgrade Gradle Codeship
#sftp -b deploy/production root@127.0.0.1
scp -rp ~/clone/* root@127.0.0.1:/opt/app/
ssh root@127.0.0.1 'sudo chmod +x /opt/app/bin/stop.sh'
ssh root@127.0.0.1 'sudo /opt/app/bin/stop.sh'
ssh root@127.0.0.1 'sudo /opt/app/bin/ags-starter'
@solverit
solverit / DBSupport.scala
Last active October 14, 2017 16:33
Scala Slick
import slick.driver.JdbcProfile
/**
* Base DB support component
*
* @author Solverit
*/
trait DBSupport {
val driver: JdbcProfile