This file contains hidden or 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 jp.co.marginal.demo.model | |
import android.content.res.Resources | |
import jp.co.marginal.demo.R | |
import jp.co.marginal.demo.extension.getResourceIdList | |
/** | |
* Albums Service | |
*/ | |
class AlbumsService(private val resources: Resources) { |
This file contains hidden or 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 jp.co.marginal.demo.extension | |
import android.content.res.TypedArray | |
import android.graphics.drawable.Drawable | |
fun TypedArray.getResourceIdList(defaultValue: Int = 0): List<Int> = | |
toList{ i -> getResourceId(i, defaultValue) } | |
fun TypedArray.getDrawableList(): List<Drawable> = toList{ i -> getDrawable(i) } |
This file contains hidden or 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" encoding="utf-8"?> | |
<resources> | |
<integer-array name="album_ids"> | |
<item>1</item> | |
<item>2</item> | |
<item>3</item> | |
<item>4</item> | |
<item>5</item> | |
<item>6</item> | |
<item>7</item> |
This file contains hidden or 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
<?php | |
use App\Utils\TraitUseValidator; | |
trait HogeTrait { | |
public function sayHoge() { | |
return "hogege!"; | |
} | |
} |
This file contains hidden or 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
<?php | |
namespace App\Util; | |
/** | |
* Class TraitUseValidator | |
* @package App\Util | |
*/ | |
class TraitUseValidator | |
{ |
This file contains hidden or 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
/** | |
* Config | |
*/ | |
private val config = Configuration(ConfigFactory.load()) | |
/** | |
* 都道府県 | |
*/ | |
lazy private val prefectures: Seq[(String, String)] = { | |
val list = config.getObjectList("prefectures").getOrElse(new util.ArrayList()).asScala |
This file contains hidden or 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
# 都道府県 | |
prefectures = [ | |
{ 1 : "北海道" }, | |
{ 2 : "青森県" }, | |
{ 3 : "岩手県" }, | |
{ 4 : "宮城県" }, | |
{ 5 : "秋田県" }, | |
{ 6 : "山形県" }, | |
{ 7 : "福島県" }, | |
{ 8 : "茨城県" }, |
This file contains hidden or 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
// 30秒おきにS3上に指定ファイルが作成されているかを監視する。 | |
def notifyFileCreated(filename: String) = WebSocket.accept[JsValue, JsValue] { implicit request => | |
val path = Seq(S3_ROOT_URL, S3_BUCKET_NAME, filename).mkString("/") | |
val tick = Source.tick(initialDelay = 0.seconds, interval = 30.seconds, tick = "tick") | |
val source = tick.map { _ => | |
val created = S3Service.ls(path).nonEmpty | |
Json.toJson(Map("file_created" -> Json.toJson(created))) | |
} | |
val sink = Sink.ignore | |
Flow.fromSinkAndSource(sink, source) |
This file contains hidden or 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
// 30秒おきにS3上に指定ファイルが作成されているかを監視する。 | |
def notifyFileCreated(filename: String) = WebSocket.using[JsValue] { implicit request => | |
val path = Seq(S3_ROOT_URL, S3_BUCKET_NAME, filename).mkString("/") | |
val out: Enumerator[JsValue] = Enumerator.generateM(Promise.timeout({ | |
val created = S3Service.ls(path).nonEmpty | |
Some(Json.toJson(Map("file_created" -> Json.toJson(created)))) | |
}, 30.seconds.toMilli)) | |
(Iteratee.ignore[JsValue], out) | |
} |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
NewerOlder