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
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; |
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
Note 1: The following CQ curl commands assumes a admin:admin username and password. | |
Note 2: For Windows/Powershell users: use two "" when doing a -F cURL command. | |
Example: -F"":operation=delete"" | |
Note 3: Quotes around name of package (or name of zip file, or jar) should be included. | |
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console) | |
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle" | |
Install a bundle | |
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F |
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
#!/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 \ |
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
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 |
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
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; |
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
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 |
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
#!/bin/bash | |
# first argument: file | |
# second argument: searchstring | |
# | |
find "$1" -name "*.jar" -exec sh -c 'jar -tf {}|grep -H --label {} '$2'' \; |
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
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 { |
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
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); |
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
import java.lang.reflect.Type; | |
import java.util.List; | |
import com.google.gson.Gson; | |
import com.google.gson.reflect.TypeToken; | |
public class MapData { | |
private int id; | |
private String city; | |
private String street; |