Skip to content

Instantly share code, notes, and snippets.


Arnaud Esteve aesteve

  • Lille
Block or report user

Report or block aesteve

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
timyates / uncurry.groovy
Created May 5, 2016
Uncurry(?) in Groovy
View uncurry.groovy
// Change a method reference into a closure that takes the delegate as the first parameter
import org.codehaus.groovy.runtime.MethodClosure
def uncurry(MethodClosure c) {
{a, ...b -> a."$c.method"(*b) }
// So uncurrying gives us a closure that will take {x, y ->}
def plus = uncurry(Number.&plus)
assert plus(1, 2) == 3
sidharthkuruvila / gist:3154845
Created Jul 21, 2012
Utility to functions to convert between camel case and underscore separated names
View gist:3154845
* Takes a camel cased identifier name and returns an underscore separated
* name
* Example:
* camelToUnderscores("thisIsA1Test") == "this_is_a_1_test"
def camelToUnderscores(name: String) = "[A-Z\\d]".r.replaceAllIn(name, {m =>
"_" +
You can’t perform that action at this time.