I hereby claim:
- I am melix on github.
- I am melix (https://keybase.io/melix) on keybase.
- I have a public key whose fingerprint is 3312 24E1 D7BE 883D 16E8 A685 825C 06C8 27AF 6B66
To claim this, I am signing this object:
// "macro" builds the AST of the corresponding block | |
def ast1 = macro { foo(a) + foo(a) } | |
def ast2 = macro { foo(a) + foo(foo(a)) } | |
// we build another AST which will be used as a pattern | |
def pattern = macro { | |
x + foo(x) | |
}.withConstraints { | |
// declare that x is not a variable, but a placeholder | |
placeholder x |
I hereby claim:
To claim this, I am signing this object:
import org.codehaus.groovy.reflection.ClassInfo | |
import org.codehaus.groovy.runtime.MethodRankHelper | |
trait FatFingers { | |
def methodMissing(String name, args) { | |
def ci = ClassInfo.getClassInfo(this.class) | |
def methods = [*ci.metaClass.methods,*ci.metaClass.metaMethods] | |
def sugg = MethodRankHelper.rankMethods(name,args,methods) | |
if (sugg) { | |
sugg[0].invoke(this, args) |
// add this to build.gradle | |
gradle.taskGraph.whenReady { | |
allprojects { | |
tasks.withType(GroovyCompile) { task -> | |
logger.lifecycle("Task $task") | |
task.groovyOptions.forkOptions.jvmArgs=['-noverify'] | |
} | |
} | |
} |
import groovy.transform.ASTTest | |
import groovy.transform.CompileStatic | |
import groovy.transform.Immutable | |
import org.codehaus.groovy.ast.ClassNode | |
import org.codehaus.groovy.control.CompilePhase | |
@ASTTest(phase=CompilePhase.INSTRUCTION_SELECTION,value={ | |
ClassNode cn = node | |
def config = cn.compileUnit.config | |
def cu = cn.compileUnit.classLoader.createCompilationUnit(config, null) |
import static Double.POSITIVE_INFINITY as ∞ | |
∞.times { | |
println it | |
Thread.sleep(1000) | |
} |
package me.champeau.gr8confagenda.app; | |
import android.os.AsyncTask; | |
import groovy.lang.Closure; | |
/** | |
* An implementation of {@link android.os.AsyncTask} which makes it easy to deal with | |
* requests/callbacks using Groovy closures | |
*/ |
// Tired of AsyncTask in Android? | |
// Here's how you could write it in Groovy! | |
Fluent.async { | |
new URL('http://foo').text | |
}.then { text -> | |
textView.text = text | |
} |
import org.codehaus.groovy.control.CompilerConfiguration | |
/* | |
* Copyright 2003-2014 the original author or authors. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |
import groovy.transform.CompileStatic | |
import java.lang.invoke.CallSite | |
import java.lang.invoke.ConstantCallSite | |
import java.lang.invoke.MethodHandle | |
import java.lang.invoke.MethodHandles | |
import java.lang.invoke.MethodType | |
import java.lang.invoke.SwitchPoint | |
import static groovyjarjarasm.asm.Opcodes.* |