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 / ClientLibUseObject.java
Created May 14, 2019 — forked from nateyolles/ClientLibUseObject.java
Custom ClientLibUseObject Java-Use POJO to create custom HTML markup
View ClientLibUseObject.java
package apps.clientlib_async.sightly.templates;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Collection;
import java.util.List;
import java.util.ArrayList;
import javax.script.Bindings;
@dfparker2002
dfparker2002 / component.html
Created May 14, 2019 — forked from kevinweber/component.html
HTL/Sightly: "Use and call template" pattern. Put template into separate file for reusability, and pass parameters when calling it. Note that in most cases it's not necessary to pass "properties" to the template because they work even if they're not passed explicitly.
View component.html
<sly data-sly-use.component="template.html"
data-sly-call="${component.template @ properties=properties}" />
View SightlyClientLibInclude.html
<head data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}">
<!--/* for css+js */-->
<meta data-sly-call="${clientLib.all @ categories='your.clientlib'}" data-sly-unwrap></meta>
<!--/* only js */-->
<meta data-sly-call="${clientLib.js @ categories='your.clientlib'}" data-sly-unwrap></meta>
<!--/* only css */-->
<meta data-sly-call="${clientLib.css @ categories='your.clientlib'}" data-sly-unwrap></meta>
View OptionalUnitTest.java
/*
src: https://github.com/FDPro/baeldung/blob/4de89f8a63f6d3249cc0f2aff96b577f095d723c/core-java-8/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java
*/
import com.baeldung.optional.Modem;
import com.baeldung.optional.Person;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
@dfparker2002
dfparker2002 / BinaryTree.java
Created Apr 26, 2019
BinaryTree example + test
View BinaryTree.java
/*
src: https://github.com/eugenp/tutorials/blob/8a8be56535978fab018ab7f26d12c3028c67bdd9/data-structures/src/main/java/com/baeldung/tree/BinaryTree.java
*/
import java.util.LinkedList;
import java.util.Queue;
public class BinaryTree {
Node root;
@dfparker2002
dfparker2002 / YesNo.java
Created Apr 8, 2019
Enum jaxb-unmarshalling
View YesNo.java
/*
src https://www.codemiles.com/java/how-to-use-enum-in-jaxb-unmarshalling-t5665.html
*/
@XmlType(name = "yes_no")
@XmlEnum
public enum YesNo {
@XmlEnumValue("yes")
YES("yes"),
@XmlEnumValue("no")
@dfparker2002
dfparker2002 / SetOperations.java
Created Apr 8, 2019
Java 8, Guava, Apache collections Set operations
View SetOperations.java
/*
src https://github.com/eugenp/tutorials/blob/4d0bffbacd11bd5151eba98fd2d5da515ff3121e/core-java-collections-set/src/test/java/com/baeldung/set/SetOperations.java
*/
import static org.junit.Assert.*;
import org.apache.commons.collections4.SetUtils;
import org.junit.Test;
import com.google.common.collect.Sets;
@dfparker2002
dfparker2002 / ResourceTree.java
Created Apr 4, 2019
ResourceTree iterate all resources in a tree
View ResourceTree.java
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import org.apache.sling.api.resource.Resource;
public class ResourceTree {
private Resource root;
public static Stream<ResourceTree> stream(Resource resource) {
@dfparker2002
dfparker2002 / AbstractIntegrationTest.java
Created Mar 25, 2019 — forked from klcodanr/AbstractIntegrationTest.java
An abstract class for creating integration tests to use the Sling Remote Testing Tools to test AEM / Adobe CQ5 projects.
View AbstractIntegrationTest.java
package com.sixdimensions.wcm.cq.it;
import java.io.IOException;
import org.apache.sling.testing.tools.http.RequestExecutor;
import org.apache.sling.testing.tools.sling.SlingClient;
import org.apache.sling.testing.tools.sling.SlingTestBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
View Java8SortUnitTest.java
/*
src: https://github.com/kwoyke/tutorials/blob/e398e2bae02c8991867bbc38dad9171013d8299b/core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java
*/
import static org.hamcrest.Matchers.equalTo;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
You can’t perform that action at this time.