Skip to content

Instantly share code, notes, and snippets.

View kenichiro22's full-sized avatar

Kenichiro Tanaka kenichiro22

  • Tokyo, Japan
  • 00:36 (UTC +09:00)
View GitHub Profile
@halcat0x15a
halcat0x15a / pipe.md
Last active March 19, 2024 03:30
Pipe

Pipeモナドの紹介

Scalaの記事です。Haskellはあまり書けません。

Iterateeの複雑さから開放されたいのでPipe系ライブラリ使いましょうという記事です。

Iterateeとの比較や簡単な使い方についてつらつらと書いていきます。

Iterateeについて

@Timshel
Timshel / CustomMessagesPlugin.scala
Last active December 20, 2015 01:58 — forked from playxamplez-admin/CODE
#play2.1 custom #MessagesPlugin to add messages from different sources
package play.api.i18n
import play.api._
import play.api.i18n._
import scala.collection.JavaConverters._
import scalax.file._
import scalax.io.JavaConverters._
@j5ik2o
j5ik2o / gist:5660744
Last active November 18, 2021 11:04
Scala 2.10 & SBT & JRebel & IntelliJ IDEAの環境構築方法

できること

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

前提

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

@gakuzzzz
gakuzzzz / 1.md
Created May 21, 2013 09:14
ScalikeJDBC つれづれ
  def cond[A](value: A)(f: PartialFunction[A, SQLBuilder => SQLBuilder]): SQLBuilder

こんな感じの(実際にはSQLBuilderはサブクラス型にしないとだけど)あれば下みたいに書けるかなー

  val id: Option[Int] = ...
  val name: Option[String] = ...
@jroper
jroper / MyManagedResource.scala
Last active November 4, 2021 10:20
Play resource routing
class MyManagedResource extends ResourceController[String] {
def index = Action(Ok("index"))
def newScreen = Action(Ok("new"))
def create = Action {
Redirect(MyInjectableResource.reverseRoutes.index())
}
def show(id: String) = Action(Ok("Show " + id))
@lukas-vlcek
lukas-vlcek / gist:5143799
Last active February 7, 2023 21:50
Adding a new analyzer into existing index in Elasticsearch (requires close/open the index). Tested with Elasticsearch 0.19.12.
// create an index with an analyzer "myindex"
curl -X PUT localhost:9200/myindex -d '
{
"settings" : {`
"index":{
"number_of_replicas":0,
"number_of_shards":1,
"analysis":{
"analyzer":{
"first":{
@xuwei-k
xuwei-k / not_tailrec.scala
Created June 26, 2012 16:32 — forked from j5ik2o/gist:2996293
リトライハンドラーの殴り書き
object RetryUtil {
case class RetryException(throwables: List[Throwable]) extends Exception
def retry[T](retryLimit: Int, retryInterval: Int, shouldCatch: Throwable => Boolean)(f: => T): T = {
// @annotation.tailrec
def _retry( errors: List[Throwable], f: => T):T = {
try {
f
} catch {
@lyricallogical
lyricallogical / gist:2470715
Created April 23, 2012 12:49
play2.0 の anorm の問題点をまとめてみる。間違いがあったらコメントしてもらえると助かります。問題がなければ本家に対してまとまった形で報告するつもりです。最終的な目標は anorm の改善です。

play2.0 の anorm の問題点まとめ

実装の詳細が公開されている

Useful 等の公開すべきでないものが公開されている。 型が書かれていない public なメンバも多く、API に対する意識が低い。

不要なものが公開されている

Pk, Id, NoAssigned 等は Magic のために導入された型だが、

def index(id:String) = Action {
getFirstData(id)
}
private def getFirstData(id:String) = {
Cache.get(id) match {
case Some(id2) => getSecondData(id2)
case None => NotFound
}
}
private def getSecondData(id2:String) = {
@cynipe
cynipe / git-flow-with-maven-release-plugin.rst
Created March 22, 2012 07:49
git-flow + maven-release-plugin用の手順

git-flow + maven-release-plugin用の手順

前提

プロジェクトのルートPOMに以下の設定が書かれている必要がある。

SCM情報の設定