Skip to content

Instantly share code, notes, and snippets.

View kmizu's full-sized avatar

Kota Mizushima kmizu

View GitHub Profile
@j5ik2o
j5ik2o / gist:5660744
Last active November 18, 2021 11:04
Scala 2.10 & SBT & JRebel & IntelliJ IDEAの環境構築方法

できること

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

前提

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

@kmizu
kmizu / log.txt
Created February 5, 2013 05:04 — forked from xuwei-k/log.txt
[error]
[error] last tree to typer: term $outer
[error] symbol: value $outer (flags: <synthetic> <paramaccessor> <triedcooking> private[this])
[error] symbol definition: private[this] val $outer: unit.ScalateHelperSpec
[error] tpe: <notype>
[error] symbol owners: value $outer -> anonymous class $anonfun -> value <local ScalateHelperSpec> -> class ScalateHelperSpec -> package unit
[error] context owners: value u -> value $anonfun -> value $anonfun -> method apply -> anonymous class $anonfun$apply$4 -> method apply -> anonymous class $anonfun$1 -> value <local ViewSpec> -> class ViewSpec -> package functional
[error]
[error] == Enclosing template or block ==
[error]
@xuwei-k
xuwei-k / log.txt
Created February 4, 2013 17:50
Scala 2.10.0 compiler crash
[error]
[error] last tree to typer: term $outer
[error] symbol: value $outer (flags: <synthetic> <paramaccessor> <triedcooking> private[this])
[error] symbol definition: private[this] val $outer: unit.ScalateHelperSpec
[error] tpe: <notype>
[error] symbol owners: value $outer -> anonymous class $anonfun -> value <local ScalateHelperSpec> -> class ScalateHelperSpec -> package unit
[error] context owners: value u -> value $anonfun -> value $anonfun -> method apply -> anonymous class $anonfun$apply$4 -> method apply -> anonymous class $anonfun$1 -> value <local ViewSpec> -> class ViewSpec -> package functional
[error]
[error] == Enclosing template or block ==
[error]
import language.experimental.macros
import language.implicitConversions
import scala.reflect.macros.Context
import scala.reflect.runtime.universe.Tree
class ReflectiveClosure[A, B](val tree: Tree, fn: Function1[A, B]) extends Function1[A, B] {
def apply(x: A) = fn(x)
}
object ReflectiveClosure {
@rosylilly
rosylilly / gist:3401612
Created August 20, 2012 06:40
先輩と覚える HTTP ステータスコード

先輩に学ぶ HTTP Status Code

超雑にまとめました。修正してください。

登場人物

  • アプリケーション先輩: いつも忙しい。横に広がるのが得意(デブじゃない)。
  • 後輩: 頼んでばっかしで役に立たない。
  • サーバー先輩: アプリケーション先輩と仲がいい。Unix Socket でつながるくらい仲良し。
  • プロクシ先輩: アプリケーション先輩とかサーバー先輩と後輩の間を取り持って代わりに伝えたりしてくれる。たまに勝手にレスポンスを書き換える。
@teamon
teamon / app.coffee
Created May 15, 2012 20:36
Backbone.js jQuery file upload with autosave
# This will automatically create or update model
onRender: =>
[method, url] = if @model.isNew()
["POST", mymodels_path()]
else
["PUT", model_path(@model.id)]
@$(".upload").fileupload(
dataType: 'json'
def foo[A,B](in:Option[A])(valid:PartialFunction[Option[A],Either[B,A]])(invalid:PartialFunction[Option[A],Either[B,A]])(other: =>Either[B,A]) = {
if(!valid.isDefinedAt(in) && !invalid.isDefinedAt(in)) {
other
}else{
(valid orElse invalid)(in)
}
}
def getFirstData(id:String) = {
foo(Cache.get(id)){
@teamon
teamon / Auth.scala
Created April 8, 2012 13:43
Play2.0 with Github OAuth2 example
package controllers
import lib._
import play.api.mvc._
import play.api.libs.json._
object Auth extends Controller {
val GITHUB = new OAuth2[GithubUser](OAuth2Settings(
@devpuppy
devpuppy / nokogiri libxml homebrew lion
Created November 8, 2011 23:26
How to fix: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
FIXME:
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
or
libxml_ruby.bundle: dlsym(0x10fde1900, Init_libxml_ruby): symbol not found
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
@gseitz
gseitz / .sbt
Created July 22, 2011 19:01
Separate global plugins/settings folder per sbt version
## Note: the system property `sbt.global.base` was introduced in 0.10.1
## sbt-0.10.0 still uses the default global directory in ~/.sbt
gseitz@QBallz ~/.sbt % find . -name '*target*' -prune -o -print
.
./0.10.1
./0.10.1/plugins
./0.10.1/plugins/build.sbt
./0.10.1/plugins/project