Skip to content

Instantly share code, notes, and snippets.

@yan-kisen
yan-kisen / content.xml.template
Created May 20, 2015 19:03
Create Batch CQ5 Tags
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:description=""
jcr:primaryType="cq:Tag"
jcr:title="DIRNAME"
sling:resourceType="cq/tagging/components/tag"/>
@yan-kisen
yan-kisen / dps.sh
Last active November 19, 2015 20:18 — forked from GottZ/dps.sh
/etc/profile.d/dps.sh
# Docker PS prettifier
# revision 7
# https://gist.github.com/GottZ/4a6c2af314d73cd8b71d
dps() {
docker ps $@ --format "table{{ .ID }}\\t{{ .Image }}\\t{{ .Names }}\\t{{ .Status }}\\t{{ .Ports }}" | awk '
NR % 2 == 0 {
printf "\033[0m";
}
NR % 2 == 1 {

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@yan-kisen
yan-kisen / myObject.js
Created December 1, 2016 16:10
Creating a global Js Object
( function( $ ) {
// Create a jQuery Object.
$.fn.myObject = function() {
var target = this; // Store the target element in this variable (jQuery stuff).
// Our stuff.
var myObject = {
/**
@yan-kisen
yan-kisen / jsClass.jQuery.js
Created December 1, 2016 16:11 — forked from aubreypwd/jsClass.jQuery.js
How to create a Js application as a jQuery plugin
( function( $ ) {
// Create a jQuery Object.
$.fn.myObject = function() {
var $target = this; // Store the target element in this variable (jQuery stuff).
// Our stuff.
var application = {
/**
@yan-kisen
yan-kisen / Nested Paragraph Systems in CQ5
Created December 1, 2017 06:26 — forked from kand/Nested Paragraph Systems in CQ5
Sometimes nested paragraph systems are needed for special layout type components in CQ5. Here is a custom paragraph system that will overcome the issues related to nesting out of the box paragraph systems.
Set up your file structure for the innerParsys component:
innerParsys
-> parsys
-> new
- _cq_editConfig.xml
- .content.xml
- _cq_editConfig.xml
- .content.xml
- parsys.jsp
@yan-kisen
yan-kisen / Custom Sidekick Dialog in CQ5
Created December 1, 2017 06:28 — forked from kand/Custom Sidekick Dialog in CQ5
Add a custom dialog as an option in the sidekick. customSidekickDialog.js will add another action to the DEFAULT_ACTIONS list for the sidekick. In this example, the action will open a dialog but, in practice, you could put any action you wanted in the handler. launchSidekick.js is Javascript that should replace the Javascript in your project tha…
Set up your file structure something like this:
/apps/your-site/components/page
-> yourPage
-> clientlibs
-> js
-> customSidekickDialog.js
-> .content.xml
-> js.txt
-> customDialog.xml
@yan-kisen
yan-kisen / vlt CLI utils
Last active December 1, 2017 08:10 — forked from asabaylus/vlt add remove
Useful commands for working with Adobe CQ5 VLT
# remove from CRX all files deleted from file system
$ vlt st | grep ! | cut -c 2- | xargs -I {} vlt rm {}
# add to CRX all files not yet in vlt control
$ vlt st | grep \? | cut -c 2- | xargs -I {} vlt add {}
# add all missing files into the CRX
vlt st | grep ^A | cut -c 2- | xargs -I {} vlt commit --force {}
# copy all modified files into the CRX
@yan-kisen
yan-kisen / SlingResourceResolutionServlet.java
Created December 1, 2017 08:09 — forked from nateyolles/SlingResourceResolutionServlet.java
Get the HTML markup for a resource in Apache Sling.
package com.nateyolles.sling;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
import org.apache.sling.engine.SlingRequestProcessor;
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