SQL2
All nodes with a specific name
SELECT * FROM [nt:unstructured] AS node
WHERE ISDESCENDANTNODE(node, "/search/in/path")
AND NAME() = "nodeName"
All pages below content path
var docWidth = document.documentElement.offsetWidth; | |
[].forEach.call( | |
document.querySelectorAll('*'), | |
function(el) { | |
if (el.offsetWidth > docWidth) { | |
console.log(el); | |
} | |
} | |
); |
#! /usr/bin/env groovy | |
import com.sun.net.httpserver.HttpServer | |
/** | |
* http://localhost:8080/hello | |
*/ | |
HttpServer.create(new InetSocketAddress(8080), 0).with { | |
createContext("/hello") { http -> | |
http.responseHeaders.add("Content-type", "text/plain") | |
http.sendResponseHeaders(200, 0) |
SQL2
All nodes with a specific name
SELECT * FROM [nt:unstructured] AS node
WHERE ISDESCENDANTNODE(node, "/search/in/path")
AND NAME() = "nodeName"
All pages below content path
// based on http://groovyconsole.appspot.com/script/277001 from melix | |
def spinner = '|/-\\' | |
print ' ' // need to print something so it can be deleted | |
(0..100).each { i -> | |
print "\u0008${spinner[i%4]}" | |
Thread.sleep(100) // replace with whatever operation you want ;) | |
} |
// inspired by https://kousenit.org/2016/07/16/fun-with-time-zones-in-java-8/ | |
import java.time.* | |
import java.time.format.* | |
final boolean shouldIncludeHourOffsets = false | |
LocalDateTime now = LocalDateTime.now() | |
List<ZonedDateTime> zdts = ZoneId.availableZoneIds | |
.collect { now.atZone(ZoneId.of(it)) } | |
.findAll { shouldIncludeHourOffsets || it.offset.totalSeconds % (60*60) != 0 } | |
.sort { it.offset.totalSeconds } |
@Grab('org.springframework.ws:spring-ws-core:2.2.0.RELEASE') | |
@Grab('org.springframework.ws:spring-xml:2.2.0.RELEASE') | |
import org.springframework.ws.client.core.WebServiceTemplate | |
import org.springframework.ws.soap.client.core.SoapActionCallback | |
import org.springframework.ws.soap.saaj.SaajSoapMessageFactory | |
import org.springframework.xml.transform.StringSource | |
import groovy.util.slurpersupport.GPathResult | |
import groovy.util.XmlSlurper |
// You will need the VFS plugin | |
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.0' | |
classpath 'org.ysb33r.gradle:vfs-gradle-plugin:0.5' | |
classpath 'commons-httpclient:commons-httpclient:3.1' |