Skip to content

Instantly share code, notes, and snippets.

View hayasshi's full-sized avatar

HAYASHI Daisuke hayasshi

View GitHub Profile
@hayasshi
hayasshi / release.md
Last active February 13, 2018 09:05
Release sbt projects using Sonatype.

つかったもの

  • sbt-pgp
  • sbt-sonatype
  • sbt-release

手順

  • Sonatype設定
  • SBTのマニュアルに従って、SonatypeのプロジェクトJIRAにアカウントを作成する。
@hayasshi
hayasshi / chapter2-3.md
Last active August 29, 2015 14:23
Programing in Scala

Chapter 2

Scalaプログラミングの第一歩

  • Scalaインタープリタ(REPL)
  • 変数、定数
  • 関数(メソッド)
  • whileループ
  • ifループ
  • インクリメンタル演算子、デクリメント演算子はない
  • foreachとforによる反復実行
import scala.slick.driver.JdbcDriver.simple._
val db = Database.forURL("jdbc:h2:mem:slicktest", driver = "org.h2.Driver")
implicit val session = db.createSession()
session.close()
db.withSession { implicit session =>
// query
}
lazy val project = Project (
"app_name",
file(".")
).enablePlugins(PlayScala).settings(
// VersionとかlibraryDependenciesとか
)
name := "app_name"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
// libraryDependencies
)
play.Project.playScalaSettings
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.0")
sbt.version=0.13.5
@echo off
SET CURRENT_DIR=%~dp0
SET JAVA_OPTION=-Xms128m -Xmx512m -server -Dhttp.port=9000
SET CLASS_PATH=%CURRENT_DIR%app\lib\*
SET ARGS=%CURRENT_DIR%app\
java %JAVA_OPTION% -cp "%CLASS_PATH%" play.core.server.NettyServer %ARGS%
Object Resource {
// 実行時例外
val prop1 = new Properties
prop1.load(new FileInputStream("config.properties")) // -> FileNotFoundExceptionが投げられる
// target/scala-ver/classes/config.propertiesが読み込まれる
// (コンパイル前: src/main/resources/config.properties)
val prop2 = new Properties
prop2.load(this.getClass().getClassLoader().getResourceAsStream("config.properties")) // -> 読み込む