This file contains 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 lang="en"> | |
<head> | |
<title>Example DOAP embedded in HTML</title> | |
<script type="application/asf.doap+xml"> | |
<rdf:RDF xml:lang="en" | |
xmlns="http://usefulinc.com/ns/doap#" | |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |
xmlns:asfext="http://projects.apache.org/ns/asfext#" |
This file contains 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
<html> | |
<body> | |
<p>Load this page with <code>?ok=yes+it+works</code> to test it.</p> | |
<p>Search parameters: <b id="results"/></p> | |
<script> | |
const p = new URLSearchParams(window.location.search); | |
document.querySelector('#results').textContent = p.get('ok'); | |
</script> | |
</body> | |
</html> |
This file contains 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
// List custom element names registered in the current browser page | |
console.log( | |
[...new Set([].map.call( | |
document.querySelectorAll('*'), | |
el => el.nodeName.toLowerCase())) | |
].filter( | |
customElements.get.bind(customElements) | |
) | |
.sort() | |
) |
This file contains 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
// @ts-check | |
const { test, expect } = require('@playwright/test'); | |
test.beforeEach(async ({ page }) => { | |
await page.goto('https://demo.playwright.dev/todomvc'); | |
}); | |
const TODO_ITEMS = [ | |
'buy some cheese', | |
'feed the cat', |
This file contains 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
// From https://web.dev/declarative-shadow-dom/ | |
// TODO do nothing in a browser that already supports declarative shadow DOM? | |
(function attachShadowRoots(root) { | |
root.querySelectorAll("template[shadowroot]").forEach(template => { | |
const mode = template.getAttribute("shadowroot"); | |
const shadowRoot = template.parentNode.attachShadow({ mode }); | |
shadowRoot.appendChild(template.content); | |
template.remove(); | |
attachShadowRoots(shadowRoot); | |
}); |
This file contains 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 lang="en"> | |
<!-- Also stored at https://codepen.io/bdelacretaz/pen/OJEWQLO --> | |
<head> | |
<title>AEM Headless Adventures</title> | |
<style type="text/css"> | |
body { | |
font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif; | |
} |
This file contains 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
<div itemscope itemid="gist:example-intro"> | |
<!-- | |
POSTing this element will cause it to be written to the | |
Gist that the "gist" meta element above points to. | |
--> | |
<p> | |
This introduction can be <em>edited</em> and is stored <strong>in a Gist</strong>. | |
</p> | |
<p> | |
We use Gists initially as the API is super simple, and once that works we can "graduate" |
This file contains 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
<% | |
/* | |
Demo script for my adaptTo 2021 talk, on Apache Sling repoinit: | |
https://adapt.to/2021/en/schedule/repoinit-a-mini-language-for-content-repository-initialization.html | |
Generate and execute a number (see "limit" below) of repoinit statements. | |
To use this, save this script as repoinit.esp, create | |
a node with a unique resource type that points to it | |
and request that node with the appropriate extension: |
This file contains 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
///usr/bin/env jbang "$0" "$@" ; exit $? | |
import java.util.function.Supplier; | |
public class LazyLoading { | |
static int callCount = 0; | |
/** This is the core lazy loading functionality */ | |
static class LazyLoader<T> { | |
private final Supplier<T> sup; |
This file contains 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
diff --git a/src/test/java/org/apache/sling/commons/metrics/internal/MetricServiceTest.java b/src/test/java/org/apache/sling/commons/metrics/internal/MetricServiceTest.java | |
index a8af34a..ad0db8c 100644 | |
--- a/src/test/java/org/apache/sling/commons/metrics/internal/MetricServiceTest.java | |
+++ b/src/test/java/org/apache/sling/commons/metrics/internal/MetricServiceTest.java | |
@@ -22,6 +22,8 @@ package org.apache.sling.commons.metrics.internal; | |
import java.lang.management.ManagementFactory; | |
import java.util.Collections; | |
import java.util.Set; | |
+import java.util.UUID; | |
+import java.util.concurrent.atomic.AtomicInteger; |
NewerOlder