Skip to content

Instantly share code, notes, and snippets.

@aya-eiya
aya-eiya / main.dart
Last active December 7, 2023 12:20
periwinkle-flora-7707
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
/// Flutter code sample for [NavigationRail].
void main() => runApp(const NavigationRailExampleApp());
final GoRouter _router = GoRouter(
routes: <RouteBase>[
GoRoute(
@aya-eiya
aya-eiya / marge_map.dart
Last active July 27, 2020 03:41
Mapをマージしたいという質問への回答
void main() {
// 値を直接弄ってはいけない
// const か Map.unmodifiable で保護する
const firstMap = [
{"id": 333, "name": "山田 太郎", "gender": "F", "birth_date": "19880205"},
{"id": 111, "name": "山田 次郎", "gender": "F", "birth_date": "19880205"},
{"id": 121, "name": "山田 花子", "gender": "F", "birth_date": "19880205"}
];
const secondMap = [
{
void main() {
final list1 = [
const Fruits(id: 1, order: 2, name: '🍌'),
const Fruits(id: 2, order: 1, name: '🍎'),
const Fruits(id: 3, order: 3, name: '🍊'),
];
list1..sort();
print(list1);
}
@aya-eiya
aya-eiya / App.scala
Last active November 14, 2017 06:15
vert.x+Scala build with GradleでWebサービス作ってみる ref: https://qiita.com/aya_eiya/items/e9eb2306e93772d4ba95
package jp.sample
import io.vertx.scala.core.Vertx
import io.vertx.scala.ext.web._
object App {
def main(args : Array[String]) {
val vertx = Vertx.vertx()
val router = Router.router(vertx)
router.route().handler(context=>{
@aya-eiya
aya-eiya / Practice1ASol.java
Last active August 23, 2017 08:25
初心者向けJava8ラムダ演習1 解答例 ref: http://qiita.com/aya_eiya/items/99ec41b1a49549017bd0
import java.util.stream.Stream;
public class Practice1ASol {
static public void main(String[] args) {
Stream.of("Hello", " ", "World", "!").forEach(System.out::print);
}
}
@aya-eiya
aya-eiya / Practice1.java
Last active August 23, 2017 07:14
初心者向けJava8ラムダ演習1 ref: http://qiita.com/aya_eiya/items/798fb1d3f87491e9f6fb
import java.util.List;
import java.util.ArrayList;
public class Practice1 {
static public void main(String[] args) {
List<String> helloWorld = new ArrayList<String>(3);
helloWorld.add("Hello");
helloWorld.add(" ");
helloWorld.add("World");
helloWorld.add("!");
@aya-eiya
aya-eiya / file0.txt
Created May 2, 2017 09:48
NginxのTCP Proxy機能とMail Proxy機能を使って常にSMTPをlocalhost:25で受けられるようにする ref: http://qiita.com/aya_eiya/items/dbd2ffff1f07a7bfedd6
$ nginx -V 2>&1 | sed -e 's/--/\n--/g' | grep -e '\(version\|stream\|mail\)'
nginx version: nginx/1.11.9
--with-stream=dynamic
--with-stream_ssl_module
--with-mail=dynamic
--with-mail_ssl_module
@aya-eiya
aya-eiya / AsyncController
Last active August 29, 2015 14:24
Groovyのちょっとしたこと「Grails3のAsyncを試してみる」 ref: http://qiita.com/aya_eiya/items/24ee197fbd38290c125e
package jp.eiya.aya.grails.sample
class AsyncController {
def fooService
def index() {
log.info 'start index'
fooService.sayFoo(Hero.get(params.id?:1))
log.info 'end index'
return 'foo'
}
@aya-eiya
aya-eiya / GebConfig.groovy
Last active August 29, 2015 14:22
Groovyのちょっとしたこと「gebでhtmlUnitのオプションを設定する方法」 ref: http://qiita.com/aya_eiya/items/eea2201724cc3556d098
import geb.driver.DriverRegistry
import geb.driver.NameBasedDriverFactory
driver = (Settings.gebDriver)?Settings.gebDriver:'firefox'
if(driver=='htmlunit'){
driver = {
def htmlunitDriver = new NameBasedDriverFactory(classLoader,'htmlunit').getDriver()
htmlunitDriver.webClient.options.setJavaScriptEnabled(true)
htmlunitDriver.webClient.options.setThrowExceptionOnScriptError(false)
@aya-eiya
aya-eiya / aj.valueMissing.html
Created July 11, 2014 14:28
AngularJSでValidationをかけたインプット項目に、invalidになる値を初期値として入れると値が見えなくなる ref: http://qiita.com/aya_eiya/items/20d5ada0ee3477d8843d
<!DOCTYPE html>
<html lang="ja"><head><meta charset="utf-8" /></head>
<body>
<div ng-app="app" ng-controller="validCtrl">
<form name="form" novalidate>
<input ng-model="default" ng-minlength="7" id="invalidDefault" name="default"/>{{ form.default.$error }}
<p>default:{{ default }}</p>
<p>invalidDefault.value:<span id="output"></span></p>
<script>
setInterval(function(){output.innerHTML = invalidDefault.value},5);