Skip to content

Instantly share code, notes, and snippets.

@lyricallogical
lyricallogical / cakepattern.scala
Created April 13, 2012 06:14
単に delegate するような何かを作っておけば cake pattern でも何かできるみたいな気持ち
trait Abs { def f(): Int }
trait ConA extends Abs { def f() = 1 }
trait ConB extends Abs { abstract override def f() = super.f + 1 }
trait Delegate extends Abs {
val abs: Abs
def f() = abs.f
}
class A { this: Abs =>
@lyricallogical
lyricallogical / gist:2470715
Created April 23, 2012 12:49
play2.0 の anorm の問題点をまとめてみる。間違いがあったらコメントしてもらえると助かります。問題がなければ本家に対してまとまった形で報告するつもりです。最終的な目標は anorm の改善です。

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

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

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

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

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

@tototoshi
tototoshi / trouble_with_jgit_and_JavaConversions.scala
Created July 16, 2012 02:42
trouble with jgit & scala.collection.JavaConversions
// import scala.collection.JavaConversions._
scala> val git = new Git(new FileRepositoryBuilder().findGitDir(new java.io.File("/path/to/repos")).readEnvironment().build())
git: org.eclipse.jgit.api.Git = org.eclipse.jgit.api.Git@18ed36fb
scala> git.log.addPath("foo").call.head
res49: org.eclipse.jgit.revwalk.RevCommit = commit c4554d9f46de49e449242a2aa75d39874dc99498 1342332998 ----sp
scala> git.log.addPath("foo").call.headOption
res50: Option[org.eclipse.jgit.revwalk.RevCommit] = Some(commit d3107ef998b25d70f86f1a5d530c31c02507d59e 1342012813 ----sp)
@cyx
cyx / gist:3690597
Created September 10, 2012 12:13 — forked from inkel/gist:3690584
Monit Redis
check process redis-server
with pidfile "/var/run/redis.pid"
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if 2 restarts within 3 cycles then timeout
if totalmem > 100 Mb then alert
if children > 255 for 5 cycles then stop
if cpu usage > 95% for 3 cycles then restart
if failed host 127.0.0.1 port 6379 then restart
if 5 restarts within 5 cycles then timeout
@xuwei-k
xuwei-k / monad-do-not-compose.md
Last active July 31, 2019 07:40
モナドは合成できない( Translated Tony Morris's "Monads do not compose")

モナドは合成できない

http://blog.tmorris.net/monads-do-not-compose/

わたしは、Scalaのメーリングリストで、「モナドは合成できない」といいました。これは正確にはどういう意味でしょうか?たぶん、以下が答えです。

まず最初に、FunctorApplicative そして Monad のインターフェイスから話をはじめましょう。

trait Functor[F[_]] {
@tonymorris
tonymorris / TypeClass.hs
Last active September 15, 2020 13:17
Type-class hierarchy
Moved to https://github.com/tonymorris/type-class
@takungsk
takungsk / readme_ja.md
Last active January 12, 2018 09:32
JSON4Sの日本語Readme 私訳

JSON4S Build Status

今現在 java json ライブラリを含めないで 少なくとも 6つの scala向け json ライブラリがあります。

@xuwei-k
xuwei-k / ScalazTypeclassesLaw.md
Last active December 10, 2015 01:09
Scalaz7 Typeclasses Law

Scalaz7 Typeclasses Law

  • identity
  • composite

ApplicativeLaw extends FunctorLaw

  • identityAp
  • composition
  • homomorphism
@halcat0x15a
halcat0x15a / dcg.md
Last active December 10, 2015 01:48
渋谷.cljの資料です。

!SLIDE

clojure.core.logic.dcgの紹介

@halcat0x15a

!SLIDE

これはなに?