Skip to content

Instantly share code, notes, and snippets.

😄

Nate Yolles nateyolles

😄
Block or report user

Report or block nateyolles

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
@nateyolles
nateyolles / OsgiServlet.java
Created May 25, 2017
Sample OSGi servlet in AEM
View OsgiServlet.java
@Component(
immediate = true,
service = Servlet.class,
property = {
"sling.servlet.resourceTypes=project/components/component"
}
)
@Designate(ocd = SampleOsgiServlet.Configuration.class)
public class SampleOsgiServlet extends SlingSafeMethodsServlet {
@nateyolles
nateyolles / OsgiServletAnnotation.java
Last active Jul 25, 2018
A sample OSGi Declarative Services Servlet Annotation
View OsgiServletAnnotation.java
@Component(
service = Servlet.class,
property = {
"sling.servlet.extensions=html",
"sling.servlet.selectors=foo",
"sling.servlet.paths=/bin/foo",
"sling.servlet.paths=/bin/bar",
"sling.servlet.methods=get",
"sling.servlet.resourceTypes=nt:file",
"sling.servlet.resourceTypes=project/components/component"
@nateyolles
nateyolles / SlingServletAnnotation.java
Created May 25, 2017
A sample AEM SlingServlet Felix SCR Annotation
View SlingServletAnnotation.java
@SlingServlet(
metatype = true,
paths = {
"/bin/foo",
"/bin/bar"
},
extensions = {"html"},
selectors = {"foo"},
resourceTypes = {"nt:file", "project/components/component"}
methods = "GET",
@nateyolles
nateyolles / Configuration.java
Created May 25, 2017
OSGi Declarative Services Annotations
View Configuration.java
package com.nateyolles.aem.osgiannotationdemo.core.services.impl;
import org.apache.commons.lang3.StringUtils;
import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.AttributeType;
import org.osgi.service.metatype.annotations.ObjectClassDefinition;
import org.osgi.service.metatype.annotations.Option;
@ObjectClassDefinition(name = "Annotation Demo Service - OSGi")
public @interface Configuration {
View pingnature.js
$.ajax({
url: 'https://scheduler.bookedin.com/api/v1/companies/nurtured-by-nature/dayAvailability?from=2017-01-01&to=2018-01-31',
dataType: 'jsonp',
success: function(data) {
for (var x = 0; x < data.months.length; x++) {
if (data.months[x].availability.length > 0) {
alert('opening found');
}
}
},
@nateyolles
nateyolles / .content.xml
Created Jul 13, 2016
AEM Expression Language
View .content.xml
<granite:rendercondition
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/renderconditions/simple"
expression="${param.biz == 'baz'}"
expression="${empty param.foo}"
expression="${not empty param.foo and not empty param.bar}"
expression="${param['foo'] not eq 'bar'}"
expression="${cookie.cookiename.value eq 'foo'}"
expression="${requestPathInfo.selectorString == 'edit'}"
expression="${requestPathInfo.suffix != '/foo/bar')}"
@nateyolles
nateyolles / .content.xml
Created Jul 13, 2016
AEM using Granite Render Conditions
View .content.xml
<items jcr:primaryType="nt:unstructured">
<widgetAlways
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="This always shows"
name="./widgetAlways"/>
<widgetHeaderChrome
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="This only shows when header &quot;User-Agent&quot; contains &quot;chrome&quot;"
@nateyolles
nateyolles / .content.xml
Created Jul 13, 2016
AEM using Granite Custom Render Condition
View .content.xml
<widgetCustomRenderConditionHasProperty
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="This only shows if &quot;/content/renderconditiondemo/en/jcr:content/par/text&quot; has property &quot;text&quot;"
name="./widgetCustomRenderConditionHasProperty">
<granite:rendercondition
jcr:primaryType="nt:unstructured"
sling:resourceType="renderconditiondemo/components/renderconditions/hasProperty"
resourcePath="${requestPathInfo.suffix}"
propertyName="text"/>
@nateyolles
nateyolles / hasProperty.jsp
Created Jul 13, 2016
AEM Granite Custom Render Condition
View hasProperty.jsp
<%--
==============================================================================
has property render condition
A condition that takes a resource path and property name and makes the
rendering decision based on whether that resource has the property.
/**
* The resource path of the resource to evaluate.
*/
- resourcePath (String)
/**
@nateyolles
nateyolles / .content.xml
Created Jul 13, 2016
AEM Expression Language
View .content.xml
<cancel
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/hyperlink"
text="Cancel"
href="/content/geo${granite:encodeURIPath(requestPathInfo.suffix)}"/>
You can’t perform that action at this time.