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
$(document).on("submit", ".js-admin-edit-form", function(event) { | |
//ifに引っかかったときの処理 | |
if( $("#hoge-form").val("abc") ){ | |
if($("#category").val() === "" || $("#genre").val() === "") { | |
alert("カテゴリやジャンルが選択されていません"); | |
return false; | |
} | |
} |
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
[~] /usr/libexec/java_home -v 1.8.0 19:48:27 | |
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home | |
[~] |
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
def testFunction(id: HogeId) = { | |
for { | |
hoge <- db.run(hoges.filter(_.id === id).result.headOption) | |
hugas <- db.run(hugas.filter(_.hogeId === id).result) | |
} yield (hoge, hugas) match { | |
case (Some(account), fields) => { | |
val test_val = fields map { pu => | |
(pu.name, pu.alvue) | |
} toMap; |
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
val q = for { | |
(user, pao) <- usrs.soft joinLeft paos.soft on (_.id === _.userId) | |
(pao, pa) <- paos.soft join pas.soft on (_.paId === _.id) | |
} yield (user, pao, pa) | |
db.run(q.result) map { | |
case Seq(data) => Seq(data._1.copy(pa = Some(data._3))) | |
case _ => Seq() | |
} |
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
def execute(list: Seq[Int] ) = { | |
for(data <- list) yield cRepository.findById(data) map { | |
case Some(ca) => ca.status match { | |
case Stopped => list filterNot (_ == ca.id.get) | |
case _ => list | |
} | |
case None => list | |
} | |
Future.successful(list) | |
} |
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
Future.traverse(list) { listId => | |
caRepository.findById(listId) filter { | |
case Some(c) => c.status match { | |
case Stopped => false | |
case _ => true | |
} | |
} map { cs => | |
cs.get.id.get | |
} | |
} |
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
<table id="birthday-table"> | |
<thead> | |
<tr> | |
<th>誕生月</th> | |
<th>誕生日</th> | |
<th>削除</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr id="birthday-setting[0]" > |
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
module.exports = function() { | |
$(function() { | |
var num = 0 | |
$('#add-birthday-setting').on('click', function() { | |
num = parseInt($("#birthday-table tbody tr:last").attr('id').match(/[0-9]/)) | |
var tr = $('#birthday-setting\\['+num+'\\]') | |
num++ | |
tr.clone(true) | |
.insertAfter(tr) |
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
def sendEmail = Action.async { implicit request => | |
emailAddressForm.bindFromRequest.fold( | |
error => { | |
Future.successful(BadRequest("Your Aoolication")) | |
}, | |
emailAddress => { | |
//mail transfer process | |
val email = Email( | |
"Simple email", | |
"title <[email protected]>", |
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
##例外処理 | |
scala> val n = try{"99".toInt} catch {case e:Exception => -99} | |
n: Int = 99 | |
scala> val n = try{"999".toInt} catch {case e:Exception => -99} | |
n: Int = 999 | |
scala> val n = try{ "momo".toInt } catch { case e:Exception => -99 } | |
n: Int = -99 |