Skip to content

Instantly share code, notes, and snippets.

View aya-eiya's full-sized avatar

ayabe hidetoshi aya-eiya

View GitHub Profile
@aya-eiya
aya-eiya / ImplicitClosureCoercion.groovy
Created December 6, 2013 05:36
Groovyのちょっとしたこと「Groovyの2.2がリリースされました。その1」 ref: http://qiita.com/aya_eiya/items/f2f669b67b7368b7aad0
/*
2.2.x added Implicit closure coercion
*/
interface StringFilter{
def filter(String source);
}
class SemicollonRemover{
static String remove(String source,StringFilter filter){
@aya-eiya
aya-eiya / CorrectedGoogleTopPage.groovy
Last active August 2, 2016 03:16
Groovyのちょっとしたこと「Gebによるテストについて」 ref: http://qiita.com/aya_eiya/items/613d4080da9a2bb283d6
package jp.eiya.aya.geb.practice
@Grab('org.gebish:geb-core')
import geb.Page
class CorrectedGoogleTopPage extends Page{
static url = 'https://www.bing.com' // fail
static at = {
title == 'Google'
searchBox.value() == ''
@aya-eiya
aya-eiya / file0.groovy
Created May 12, 2014 09:40
Gradle + Coberturaでsrc/test/resources以下のファイルがリソースとして読み込まれない ref: http://qiita.com/aya_eiya/items/3f48b1cc75d832d1bfae
def instDir = "$buildDir/instrumented_classes"
task setInstResources(){
dependsOn 'testClasses'
}
setInstResources << {
copy{
from sourceSets.test.output.resourcesDir
into instDir
}
}
@aya-eiya
aya-eiya / tryFinallyBothReturn.groovy
Created June 4, 2014 10:43
Groovyのちょっとしたこと「try{return func1()}finally{return func2()}の挙動」 ref: http://qiita.com/aya_eiya/items/95cd1b20cd36d8e43b88
def func = {
try{
return {print('a');0}()
}finally{
return {print('b');1}()
}
}
println func() // ab1
@aya-eiya
aya-eiya / ajs.confirm.html
Created July 11, 2014 13:26
AngularJSのカスタムバリデーションをモジュールに登録して使いまわす方法 ref: http://qiita.com/aya_eiya/items/75d558f1fc1198fa137f
<!DOCTYPE html>
<html lang="ja"><head><meta charset="utf-8" /></head>
<body>
<div ng-app="app" ng-controller="confirmCtrl">
<form name="form" novalidate>
<div>
<input type="text" ng-model="target" name="target" />
<input type="text" ng-model="targetConfirm" name="targetConfirm"
confirm="target"
/>
@aya-eiya
aya-eiya / ajs.sscroll
Created July 11, 2014 13:59
AngularJSのモジュールとしてjQueryを使ったスムーズスクロールを作ってみた。 ref: http://qiita.com/aya_eiya/items/444fb075bfbf568216a7
<!DOCTYPE html>
<html lang="ja"><head><meta charset="utf-8" /></head>
<body>
<div ng-app="app" ng-controller="scrollCtrl">
<form name="form" novalidate>
<h1 id="top">TOP</h1>
<div>
<ul>
<li><a href="" ng-click="innerLink('name1')">name1</a></li>
<li><a href="" ng-click="innerLink('id1')">id1</a></li>
@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);
@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 / 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 / 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