View some_class_under_test.rb
class SomeClassUnderTest | |
def some_method_under_test(input) | |
input.to_s | |
end | |
end |
View handler.groovy
handlers.findAll { name, handler -> | |
if (handler.match.maximumNumberOfParameters == 1) { | |
handler.match notification | |
} else { | |
handler.match notification, origin | |
} | |
}.each { name, handler -> | |
if (handler.handle.maximumNumberOfParameters == 1) { | |
handler.handle notification | |
} else { |
View gitpull.cgi
#!/usr/bin/perl | |
use Digest::SHA qw(hmac_sha1_hex); | |
open(KEYFILE, "gitpull.secret"); | |
chomp($secret = <KEYFILE>); | |
close(KEYFILE); | |
print "Content-type: text/plain\n"; | |
print "\n"; |
View User.groovy
package springpack.model | |
import grails.rest.* | |
@Resource(uri='/users', formats=['json', 'xml']) | |
class User { | |
String username | |
String email |
View Histogram.groovy
Employee.withCriteria { | |
projections { | |
groupProperty "gender" | |
rowCount() | |
} | |
}.inject([:]) { histo, row -> | |
histo[row[0]] = row[1] | |
histo | |
} |
View CopyMatcher.groovy
import org.apache.commons.lang.StringUtils | |
class CopyMatcher { | |
def triggerWord | |
def matches(product) { | |
product.productCopy.any { StringUtils.containsIgnoreCase it.copy, triggerWord } | |
} |