Skip to content

Instantly share code, notes, and snippets.

dfparker2002

Block or report user

Report or block dfparker2002

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dfparker2002
dfparker2002 / gist:264e14b0febcb98b9078
Last active Dec 20, 2015 — forked from auniverseaway/gist:21800b9a7848b2bf880c
Maven AEM Archetype 10 install command
View gist:264e14b0febcb98b9078
mvn archetype:generate \
-DarchetypeRepository=https://repo.adobe.com/nexus/content/groups/public/ \
-DarchetypeGroupId=com.adobe.granite.archetypes \
-DarchetypeArtifactId=aem-project-archetype \
-DarchetypeVersion=10 \
-DgroupId=my-group-id \
-DartifactId=myproject \
-DappsFolderName=myproject \
-DartifactName="My Project" \
-DcomponentGroupName: aemslice \
@dfparker2002
dfparker2002 / SecureLoggingUtil.java
Created Dec 31, 2015 — forked from sachin-handiekar/SecureLoggingUtil.java
Masking Sensitive Information in CXF Logging Interceptor for incoming/outgoing SOAP request. (http://www.sachinhandiekar.com/2014/11/cxf-logging-interceptor-masking.html)
View SecureLoggingUtil.java
package com.sachinhandiekar.examples.cxf.logging;
import java.io.ByteArrayInputStream;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
@dfparker2002
dfparker2002 / mvn-archetype-aem-6
Created Jan 15, 2016 — forked from kuckmc01/mvn-archetype-aem-6
AEM 6.0 ready project using Maven Archetype and Terminal
View mvn-archetype-aem-6
#!/bin/bash
# Maven archetype that will create an AEM 6.0 ready project
# Might need to change permissions in order to run
# If all else fails, copy and paste everything below this line into the terminal
mvn archetype:generate \
-DarchetypeRepository=https://repo.adobe.com/nexus/content/groups/public/ \
-DarchetypeGroupId=com.adobe.granite.archetypes \
-DarchetypeArtifactId=aem-project-archetype \
-DarchetypeVersion=10 \
View Oak offline compaction instructions.md

Offline Oak compaction with debug logging:

  1. Install the latest Oak hotfix to your AEM instance:
  1. Download the oak-run version matching your oak version: https://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run/
  2. Upload the oak-run jar file to your server
  3. Create a file logback-compaction.xml (on the server in the same folder as the oak-run jar)
@dfparker2002
dfparker2002 / nodelist-iteration.js
Created Jan 22, 2016 — forked from bendc/nodelist-iteration.js
ES6: Iterating over a NodeList
View nodelist-iteration.js
var elements = document.querySelectorAll("div"),
callback = (el) => { console.log(el); };
// Spread operator
[...elements].forEach(callback);
// Array.from()
Array.from(elements).forEach(callback);
// for...of statement
@dfparker2002
dfparker2002 / MyJobConsumerTest.java
Created Feb 11, 2016 — forked from thomashartm/MyJobConsumerTest.java
Example mock verification test snippet ... using Mockito in an AEM related unit test
View MyJobConsumerTest.java
package net.thartm.someservice.jobs;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.List;
@dfparker2002
dfparker2002 / CQ5 XPath Queries (Content)
Created Feb 11, 2016 — forked from thomashartm/CQ5 XPath Queries (Content)
A collection of CQ5 related JCR queries in the XPath query language. Some of these queries might be project specific but are a nice blueprint for similar requriements.
View CQ5 XPath Queries (Content)
Nodes with a certain attribute
//element(*)[jcr:content/@includePageInTools='true']
News without PubDate
//*[@cq:template="/apps/sampleproject/templates/newspage" and not(@pubdate)]
Pages without UUID
/jcr:root/content//element(*,cq:PageContent)[not(@uuid)]
Find Pages with component
View findinjar.sh
#!/bin/bash
# first argument: file
# second argument: searchstring
#
find "$1" -name "*.jar" -exec sh -c 'jar -tf {}|grep -H --label {} '$2'' \;
@dfparker2002
dfparker2002 / Test.java
Created Feb 12, 2016 — forked from justinedelson/Test.java
How to make a http request to get the auth token in AEM
View Test.java
import java.io.IOException;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
public class Test {
View restrictions-prefixes.groovy
def applyRestriction(path, prefix) {
def acl = getAcl(path)
def restrictions = new HashMap<String, Value>()
def values = new Value[1]
values[0] = session.getValueFactory().createValue(prefix)
restrictions.put("rep:prefixes", values)
acl.addEntry(principal, privileges, false, emptyMap, restrictions)
acMgr.setPolicy(acl.getPath(), acl);
You can’t perform that action at this time.