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
var Backend = require('i18next-node-fs-backend'); | |
//var Backend = require('i18next-sync-fs-backend'); | |
var i18next = require('i18next'); | |
var assert = require('power-assert'); | |
var config = { | |
debug: true, | |
lng: 'en', | |
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
var os = require('os'); | |
var osType = os.type(); | |
console.log(osType); | |
console.log(/^Windows/.test(osType)); | |
console.log(/^Darwin$/.test(osType)); | |
console.log(/^Windows/.test('Windows')); | |
console.log(/^Windows/.test('Windows_HOGE')); |
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
var l = [1, 2, 3]; | |
var l2 = Object.assign([], l, [4, 5]); | |
var l3 = l.concat(); | |
l3[1] = "X"; | |
console.log(l); | |
console.log(l2); | |
console.log(l3); |
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
@groovy.transform.Immutable(copyWith = true) | |
class User { | |
String name | |
Integer age | |
} | |
def user = new User(name: "おれ", age: 18) | |
assert user.is(user.copyWith()) | |
assert user.is(user.copyWith(name: "おまえ")) == 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
// http://blog.64p.org/entry/2016/09/30/014358 | |
// | |
// orelang を Groovy で実装してみた | |
// | |
// "わりとよくある JSON ベースの lisp っぽいインタープリタの実装ですが、コードを見ていてもよくわからなかったので自分で実装しなおしてみました。" | |
// | |
class OreLang { | |
Map<String, Object> vars = [:] |
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
Grails | |
★Slf4jをつけないと%lineなどがnullになる | |
Slf4jをつけるとマシになるけど、100%OKではないっぽい... | |
残っただめなのはAST変換部分?→しかたない系? | |
nullableなDateがクリアできない | |
Boolean,Double, IntegerはOK(nullクリアできる) | |
データバインディングで空文字が無視される | |
convertEmptyStringsToNull: 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
class MyResource implements Closeable { | |
@Override | |
void close() { | |
println "Closed!" | |
} | |
} | |
new MyResource().withCloseable { | |
println "HOGE" | |
throw new RuntimeException("FAILED!") |
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
// (出典) | |
// ズンドコキヨシ http://qiita.com/shunsugai@github/items/971a15461de29563bf90 | |
// ずんの飯尾(ラスボス感) http://alfalfalfa.com/articles/139689.html?utm_source=alfalfa&utm_medium=kanren_image2 | |
def random = new Random() | |
// 飯尾が強すぎるので「ずん」を恣意的に水増ししてみる | |
def words = [["ずん"] * 5, "どこ", "の", "飯尾"].flatten() | |
def buf = "" |
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
@Grab('com.github.dakusui:jcunit:0.4.10') | |
@Grab('org.spockframework:spock-core:0.7-groovy-2.0') | |
import com.github.dakusui.jcunit.core.FactorField; | |
import com.github.dakusui.jcunit.generators.TupleGeneratorFactory; | |
import com.github.dakusui.jcunit.core.tuples.Tuple; | |
import com.github.dakusui.jcunit.generators.ipo2.IPO2; | |
import com.github.dakusui.jcunit.generators.ipo2.optimizers.GreedyIPO2Optimizer; | |
import com.github.dakusui.jcunit.constraint.constraintmanagers.ConstraintManagerBase; | |
import com.github.dakusui.jcunit.constraint.ConstraintManager; | |
import com.github.dakusui.jcunit.exceptions.UndefinedSymbol; |
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 map = [a: [1], b: [2], c: [3]] | |
println map.dump() | |
// clone()の場合、コストも気になるが実際影響が出るんだった!!!!! | |
def newMap = map.clone() | |
println newMap.dump() | |
// 追加した項目は独立であるが... | |
newMap.x = "XXXX" | |
assert newMap.x == "XXXX" |