Skip to content

Instantly share code, notes, and snippets.

@blackdrag
blackdrag / SimpleHtmlBuilder.groovy
Created December 31, 2023 16:29
Very Simple Groovy HTML builder
new SimpleBuilder().html {
head {
title ("Simple Groovy HTML builder")
body {
h1 ("Simple Groovy HTML builder")
p ("this format can be used as an alternative markup to HTML")
a(href: "http://groovy-lang.org","Groovy")
p {
_ ("This is some")
b ("mixed")
@blackdrag
blackdrag / IndyCallsiteTests.ajava
Last active September 5, 2023 06:34
simple indy test with JDK 17
package indy;
import org.junit.Test;
import org.objectweb.asm.*;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.invoke.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
def min=100000,max=0, sum=0
def iterations = 10
iterations.times {
def n = 10
long t1 = System.nanoTime()
def r = fannkuch(n)
long t2 = System.nanoTime()
//println("Pfannkuchen(" + n + ") = " + r)
def t = (t2 - t1) / 1_000_000
@blackdrag
blackdrag / gist:9392916
Created March 6, 2014 16:01
meta class test for EMC overwriting potentially existing meta class
def list = []
try {
list.noSuchMethod()
assert false
} catch (MissingMethodException mme) {
assert true
}
ExpandoMetaClass.enableGlobally()