Skip to content

Instantly share code, notes, and snippets.

public Iterator<Page> getChildren() {
ResourceResolver resourceResolver = resource.getResourceResolver();
String query = "SELECT * FROM [nt:unstructured] AS s "
+ "WHERE [title] IS NOT NULL "
+ "ORDER BY [created] DESC";
Iterator<Resource> children = resourceResolver.findResources(query, Query.JCR_SQL2);
return ResourceUtil.adaptTo(children,Page.class);
}
<form method="POST" id="registerForm">
<input name="email" value="emily.andrews@mailinator.com" id="email"/>
<input type="submit" name="submit" id="submit"/>
</form>
<script type="text/javascript">
"use strict";
// Get our registration form
var registerForm = document.querySelector("#registerForm");
package org.millr.core.servlets;
import java.io.IOException;
import java.rmi.ServerException;
import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
import org.apache.sling.commons.json.JSONObject;
package org.millr.slick.auth;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.resource.ResourceResolverFactory;
@auniverseaway
auniverseaway / .content.xml
Created January 29, 2016 23:48
_cq_dialog/.content.xml
<dropdown
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/select"
fieldLabel="Dropdown"
name="./dropdown"
rootPath="/content">
<!-- Params: value, text, path -->
<datasource
jcr:primaryType="nt:unstructured"
sling:resourceType="myapp/components/utilities/datasource"
<%@page session="false" import="
org.apache.sling.api.resource.Resource,
org.apache.sling.api.resource.ResourceUtil,
org.apache.sling.api.resource.ValueMap,
org.apache.sling.api.resource.ResourceResolver,
org.apache.sling.api.resource.ResourceMetadata,
org.apache.sling.api.wrappers.ValueMapDecorator,
java.util.List,
java.util.ArrayList,
java.util.HashMap,
package org.millr.slick.utils;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Model;
@Model(adaptables=SlingHttpServletRequest.class)
public class Externalizer {
private SlingHttpServletRequest request;
@auniverseaway
auniverseaway / aem-compact-script.sh
Last active November 26, 2018 09:47
AEM Compaction Script
#!/bin/bash
now="$(date +'%d-%m-%Y')"
logfile="compact-$now.log"
installfolder="/data/aem"
aemfolder="$installfolder/crx-quickstart"
oakrun="$installfolder/help/oak-run-1.0.18.jar"
## Shutdown AEM
printf "Shutting down AEM.\n"
$aemfolder/bin/stop
@auniverseaway
auniverseaway / gist:8efe397edcef2d030641
Created October 27, 2015 18:31
Automatically log user in...
// Get our current resolver.
ResourceResolver resolver = request.getResourceResolver();
// Adapt to an anonymous session and get the repo as anonymous.
JackrabbitSession session = (JackrabbitSession) resolver.adaptTo(Session.class);
Repository repository = session.getRepository();
// Create a new session by logging into using the default admin username and password.
Session adminSession = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
Verifying that +millar is my blockchain ID. https://onename.com/millar