Skip to content

Instantly share code, notes, and snippets.

View ohneda's full-sized avatar

Yuichi Oneda ohneda

  • Fujisan Magazine Service USA
  • Berkeley CA, USA
View GitHub Profile
@ohneda
ohneda / gist:1453983
Created December 10, 2011 00:27
Print Error Log after running Tests/Specs on Grails
# Add the below into $YOUR_APP/scripts/_Events.groovy
# reference: http://d.hatena.ne.jp/masanobuimai/20090615
eventTestSuiteEnd = {type ->
new File(testReportsDir, "plain").eachFileMatch(~/.*[(Spec)|(Test)]\.txt/) { file ->
file.withReader("UTF-8") {reader ->
reader.readLine()
def line = reader.readLine()
(line =~ /.*, Failures: (\d), Errors: (\d), .*/).each {m0, m1, m2 ->
if (m1 == "0" && m2 == "0") return
println "== ${file.name} =============================================="
@ohneda
ohneda / StandardDeviationCategory.groovy
Created July 21, 2011 23:07
StandardDeviation Category for groovy, inspired by Advanced Rails
import static java.lang.Math.*
import static java.math.RoundingMode.CEILING
class StandardDeviationCategory {
static Double mean(Collection list) {
list.with{
scale(sum() / size())
}
}