Skip to content

Instantly share code, notes, and snippets.

Avatar

Roger Blanton rogerblanton

View GitHub Profile
@rogerblanton
rogerblanton / init-fix.jsp
Created Jul 23, 2014
When using sling to include CQ pages inside another CQ page, the init.jsp script will try to fire multiple times and the sidekick rendering will not work properly, instead check to see if the page you are reviewing is the actual page and use init.jsp to render sidekick, or if you are viewing it embedded in another page, disabled the init.jsp call
View init-fix.jsp
<%@include file="/myapp/includes/base-global.jsp" %>
<!-- Load sidekick only when viewing page on its own -->
<% if(currentPage.getPath().equals(resourcePage.getPath())) { %>
<cq:include script="/libs/wcm/core/components/init/init.jsp"/>
<% } %>
View CQ5 Curl Commands
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
@rogerblanton
rogerblanton / aem-templates-intellij.xml
Last active Aug 29, 2015
AEM IntelliJ Live Templates
View aem-templates-intellij.xml
<?xml version="1.0" encoding="UTF-8"?>
<templateSet group="Adobe AEM">
<template name="cqTemplate" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;jcr:root xmlns:sling=&quot;http://sling.apache.org/jcr/sling/1.0&quot; xmlns:cq=&quot;http://www.day.com/jcr/cq/1.0&quot; xmlns:jcr=&quot;http://www.jcp.org/jcr/1.0&quot;&#10; jcr:description=&quot;$DESCRIPTION$&quot;&#10; jcr:primaryType=&quot;cq:Template&quot;&#10; jcr:title=&quot;$TITLE$&quot;&#10; allowedPaths=&quot;[$ALLOWED_PATHS$]&quot;&#10; ranking=&quot;{Long}$RANKING$&quot;&gt;&#10; &lt;jcr:content&#10; cq:designPath=&quot;$DESIGN_PATH$&quot;&#10; jcr:primaryType=&quot;cq:PageContent&quot;&#10; sling:resourceType=&quot;$RESOURCE_TYPE$&quot;&gt;&#10; &lt;/jcr:content&gt;&#10;&lt;/jcr:root&gt;&#10;$END$" description="Create template for Adobe AEM" toReformat="false" toShortenFQNames="true">
<variable name="DESCRIPTION" expression="" defaultValue="&quot;Enter the description&quot
@rogerblanton
rogerblanton / smartrestize.js
Created Oct 20, 2014
Taken from Paul Irish taken from John Hann
View smartrestize.js
(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
@rogerblanton
rogerblanton / com.day.cq.commons.servlets.RootMappingServlet.xml
Last active May 26, 2016
Change the default start page of AEM 5.6+ from touch ui to classic interface
View com.day.cq.commons.servlets.RootMappingServlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
rootmapping.target="/welcome"/>
@rogerblanton
rogerblanton / .bash_aliases
Last active May 28, 2016
Make Terminal Better
View .bash_aliases
alias reloadpr="source ~/.profile"
alias cp="cp -iv"
alias mv="mv -iv"
alias ls='ls -GFh'
alias ll='ls -FGhlAp'
# Directory Navigation
alias sites='cd ~/Sites'
alias ..="cd ../"
alias ...="cd ../../"
@rogerblanton
rogerblanton / share-count.md
Last active May 26, 2016
Share Count APIs
View share-count.md

Share Counts

Twitter

GET URL:

http://cdn.api.twitter.com/1/urls/count.json?url=http://blantonmedia.com

View brackets.json
{
"fonts.fontSize": "14px",
"fonts.fontFamily": "'Monaco'",
"linting.collapsed": true,
"useTabChar": true,
"tabSize": 2,
"themes.theme": "dark_soda_theme"
}
View recursive-search.java
public static void visitRecursively(Node node, Session currentSession) {
try{
NodeIterator list = node.getNodes();
while(list.hasNext()) {
Node childNode = list.nextNode();
// Verify child node for cqPage type
if((childNode.hasProperty("jcr:primaryType")) && (childNode.getProperty("jcr:primaryType").getValue().getString()).equals("cq:Page") ){
View flushCache.java
package com.adobe.example;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;
import org.apache.felix.scr.annotations.Property;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
You can’t perform that action at this time.