Skip to content

Instantly share code, notes, and snippets.

View mumoshu's full-sized avatar
🏠
Working from home

Yusuke Kuoka mumoshu

🏠
Working from home
View GitHub Profile
trait Magma[A] {
def append(x: A, y: A): A
}
object Magma {
implicit def Monoid[A](implicit m: Monoid[A]) = new Magma[A] {
def append(x: A, y: A) = m.append(x, y)
}
}
@j5ik2o
j5ik2o / gist:5660744
Last active November 18, 2021 11:04
Scala 2.10 & SBT & JRebel & IntelliJ IDEAの環境構築方法

できること

  • JRebelを利用すると、アプリケーションの再起動なしで実行中のアプリケーションに加えた変更を即座に反映することができます(ホットリローディング)。まるでPHPのようにサクサク書けるッ!
  • Scala開発者にはライセンスが$0で提供されます。Javaで利用する場合は購入してね☆彡

前提

以下がインストールされているものとする。

using System;
using System.Collections.Generic;
namespace Utils
{
public class UnknownTypeException : Exception
{
}
public class TypeRegistry
@SeonghoonKim
SeonghoonKim / apache-balancer.sh
Last active March 8, 2022 08:12
Apache HTTPD balancer-manager control script
#! /bin/sh
# Set up a default search path
PATH="/usr/bin:/bin"
CURL=`which curl`
if [ -z "$CURL" ]; then
echo "curl not found"
exit 1
fi
@etorreborre
etorreborre / gist:5078824
Last active March 24, 2024 14:55
A good summary of Scala types from http://bit.ly/XjSVKw
class Outer {
class Inner
type Type
}
trait Trait
object Object extends Outer {
val inner = new Inner
}
class OuterP[A] {
class InnerP[B]
@nikita-volkov
nikita-volkov / gist:5000556
Last active June 15, 2016 00:05 — forked from xeno-by/gist:2559714
Mixing in a trait dynamically with Scala 2.10.0. Formatted.
@gseitz
gseitz / build.scala
Created February 19, 2013 22:52
SBT task for running all main classes
import sbt._
import Keys._
import Build.data
object build extends Build {
lazy val runAll = TaskKey[Unit]("run-all")
lazy val standardSettings = Seq(
runAllIn(Compile)
)
import scala.language.postfixOps
import scala.concurrent._
import scala.concurrent.duration._
import akka.pattern.pipe
import akka.actor._
import akka.cluster.routing._
/**
* Concept and some code lifted from
* https://github.com/jsuereth/intro-to-fp, thanks Josh!
class ClusterMetricsElasticScaleListener extends Actor with ActorLogging {
val selfAddress = Cluster(context.system).selfAddress
override def preStart(): Unit =
Cluster(context.system).subscribe(self, classOf[ClusterMetricsChanged])
override def postStop(): Unit =
Cluster(context.system).unsubscribe(self)
def receive = {
@ymasory
ymasory / build.sbt
Last active December 12, 2015 07:18
Dealing with SIP-18 (language imports) in the presence of cross-compilation in build.sbt
scalaVersion := "2.10.0"
// Let's support all "modern" Scala versions.
crossScalaVersions := Seq(
"2.9.3-RC1",
"2.9.2",
"2.9.1", "2.9.1-1",
"2.9.0", "2.9.0-1",
"2.8.0", "2.8.1", "2.8.2"
)