This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Grab('org.jsoup:jsoup:1.15.4') | |
| import org.jsoup.Jsoup | |
| import org.jsoup.safety.Safelist | |
| @Grab('io.github.furstenheim:copy_down:1.1') | |
| import io.github.furstenheim.* | |
| import java.nio.file.Paths | |
| import java.nio.file.Files | |
| import java.text.SimpleDateFormat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Controller("/product") | |
| public class ProductController { | |
| @Get | |
| @Status(HttpStatus.OK) | |
| public void index() { | |
| throw Problem.builder() | |
| .withType(URI.create("https://example.org/out-of-stock")) | |
| .withTitle("Out of Stock") | |
| .withStatus(new HttpStatusType(HttpStatus.BAD_REQUEST)) | |
| .withDetail("Item B00027Y5QG is no longer available") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HTTP/1.1 403 Forbidden | |
| Content-Type: application/problem+json | |
| Content-Language: en | |
| { | |
| "type": "https://example.com/probs/out-of-credit", | |
| "title": "You do not have enough credit.", | |
| "detail": "Your current balance is 30, but that costs 50.", | |
| "instance": "/account/12345/msgs/abc", | |
| "balance": 30, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://www.youtube.com/watch?v=7e0RGIul8Kk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://www.youtube.com/watch?v=7e0RGIul8Kk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shadow { | |
| transform { | |
| canTransformResource { FileTreeElement element -> } | |
| transform { TransformerContext context -> } | |
| hasTransformedResource { } | |
| modifyOutputStream { ZipOutputStream jos -> } | |
| } | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <title>24h Domino Clock</title> | |
| <meta http-equiv="refresh" content="60"> | |
| <script> | |
| function drawDot(context, x, y) { | |
| var lg1 = context.createLinearGradient(x - 10, y - 10, x + 20, y + 40); | |
| lg1.addColorStop(0, 'black'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Licensed to the Apache Software Foundation (ASF) under one or more | |
| * contributor license agreements. See the NOTICE file distributed with | |
| * this work for additional information regarding copyright ownership. | |
| * The ASF licenses this file to You 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 | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Grab('org.jdeferred:jdeferred-core:1.2.4') | |
| import org.jdeferred.* | |
| import org.jdeferred.impl.* | |
| def d = new DeferredObject() | |
| def p = d.promise() | |
| // gotta be explicit and can't use Groovy closures: | |
| // DoneCallback / DoneFilter / DonePite are ambiguous | |
| // in terms of signature, for SAM type coercion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Grab('org.jdeferred:jdeferred-core:1.2.4') | |
| import org.jdeferred.* | |
| import org.jdeferred.impl.* | |
| def deferred = new DeferredObject() | |
| def promise = deferred.promise() | |
| promise.done { result -> | |
| println "done: $result" | |
| }.fail { rejection -> |