Skip to content

Instantly share code, notes, and snippets.

Jean Tessier jeantessier

Block or report user

Report or block jeantessier

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jeantessier / handler.groovy
Created Jan 19, 2017
A listener class has a series of handlers, each with a `match` and a `handle` closure. Each closure has an optional `origin` parameter.
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 {
jeantessier / gitpull.cgi
Last active Jan 30, 2019
This CGI script in Perl can be the target of a GitHub webhook to automatically pull the latest version from the repo.
View gitpull.cgi
use Digest::SHA qw(hmac_sha1_hex);
open(KEYFILE, "gitpull.secret");
chomp($secret = <KEYFILE>);
print "Content-type: text/plain\n";
print "\n";
jeantessier / User.groovy
Last active Sep 5, 2015
Replace complicated Java microservice with trivial Grails 3 app.
View User.groovy
package springpack.model
@Resource(uri='/users', formats=['json', 'xml'])
class User {
String username
String email
jeantessier / Histogram.groovy
Created Oct 21, 2014
Building a histogram from a Grails criteria search.
View Histogram.groovy
Employee.withCriteria {
projections {
groupProperty "gender"
}.inject([:]) { histo, row ->
histo[row[0]] = row[1]
jeantessier / CopyMatcher.groovy
Last active Aug 29, 2015
Example of stripped down notation for Groovy, compared to Java.
View CopyMatcher.groovy
import org.apache.commons.lang.StringUtils
class CopyMatcher {
def triggerWord
def matches(product) {
product.productCopy.any { StringUtils.containsIgnoreCase it.copy, triggerWord }
You can’t perform that action at this time.