Skip to content

Instantly share code, notes, and snippets.

View kmizu's full-sized avatar

Kota Mizushima kmizu

View GitHub Profile
@kmizu
kmizu / 1.scala
Created October 16, 2012 13:10 — forked from tototoshi/1.scala
(implicit conversions + method values) cause strange problem
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.
7.0_03).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import scala.collection.immutable.StringLike
import scala.collection.immutable.StringLike
scala> "a".format(_)
res0: Any* => String = <function1>
@kmizu
kmizu / play_2_assets_pipeline.scala
Created December 7, 2012 05:55 — forked from eboto/play_2_assets_pipeline.scala
Play 2 Assets pipeline
package assetproviders {
import play.api.mvc.Action
import play.api.mvc.Controller
import play.api.mvc.AnyContent
import play.api.mvc.Call
/**
* This simple interface is meant to mimic the existing interface in Play 2.0
* for the Assets controller it provides. By implementing this it is possible
* to mix and combine various AssetProviders to create a custom Asset controller
@kmizu
kmizu / .sbt
Created January 5, 2013 17:29 — forked from gseitz/.sbt
## 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
@kmizu
kmizu / Auth.scala
Created January 8, 2013 06:00 — forked from teamon/Auth.scala
package controllers
import lib._
import play.api.mvc._
import play.api.libs.json._
object Auth extends Controller {
val GITHUB = new OAuth2[GithubUser](OAuth2Settings(
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 {
#!/usr/bin/env sh
if ! which md5sum > /dev/null; then
echo Install md5sum
exit 1
fi
if ! which curl > /dev/null; then
echo Install curl
exit 1
@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]
@kmizu
kmizu / app.coffee
Created April 22, 2013 04:37 — forked from teamon/app.coffee
# 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'

できること

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

前提

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

// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {