This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(process.argv.length < 3){ | |
console.log('target file path is required.') | |
process.exit(1) | |
} | |
var target = process.argv[2] | |
console.log('file: ' + target) | |
var fs = require('fs') | |
fs.readFile(target, function (err, data) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.tlync.android.util; | |
import android.util.Log; | |
/** | |
* Android Log wrapper class that can use {@link String#format(String, Object...)} in logging message | |
*/ | |
public class Logger { | |
private static final String TAG = Logger.class.getSimpleName(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.scalatest._ | |
import org.scalatest.GivenWhenThen | |
import play.api.libs.json._ | |
import play.api.test._ | |
import play.api.test.Helpers._ | |
class UserApiSpec extends FunSpec with GivenWhenThen with Matchers { | |
describe("Users API") { | |
describe("GET /users") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Transparent IO Context pattern using implicit parameter | |
// --- | |
// domain | |
// --- | |
// base (サンプルなのでほぼただの Marker Trait) | |
trait Entity | |
// 永続化に利用するセッションを保持するただのコンテナ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<root> | |
<appdef> | |
<appname>INTELIJ</appname> | |
<equal>com.jetbrains.intellij</equal> | |
</appdef> | |
<replacementdef> | |
<replacementname>EMACS_MODE_IGNORE_APPS</replacementname> | |
<replacementvalue> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// base (サンプルなのでただの marker trait) | |
trait Entity | |
trait Repository | |
// domain layer | |
case class User(id: Int, name: String) extends Entity | |
trait Users extends Repository { | |
def find(id: Int): Option[User] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// domain layer | |
trait Entity | |
trait Repo | |
case class Context[T](session: T) | |
trait TransparentContext[T] { | |
implicit def c2s(implicit ctx: Context[T]) = ctx.session | |
implicit def s2c(implicit session: T) = Context(session) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dummy session classes for sample codes | |
final class AnormSession { | |
def anormMethod = { | |
println("anorm") | |
} | |
def start = {} | |
def commit = {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dummy session classes for sample codes | |
final class AnormSession { | |
def anormMethod = { | |
println("anorm") | |
} | |
def start = {} | |
def commit = {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import play.api.libs.json._ | |
import play.api.libs.functional.syntax._ | |
object Main { | |
implicit val jsonFormat = | |
(__ \ "v").write[String].contramap((fb: FizzBuzz) => fb.v) | |
def main(args: Array[String]) { | |
print(Json.toJson(FizzBuzz.Fizz)) | |
print(Json.toJson(FizzBuzz.Buzz)) |
NewerOlder