Skip to content

Instantly share code, notes, and snippets.

@floriankraft
floriankraft / idea.py
Created October 8, 2019 06:33
IntelliJ IDEA starting script for opening a project from the command line (e.g. with the command `idea <your-project-dir>`). Install it in: /usr/local/bin/idea - IntelliJ provides its own starting script, but it does not work flawlessly with Linux Mint.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import struct
import sys
import os
import time
# changed (2019-07-03)
import subprocess
@floriankraft
floriankraft / beyond-compare.nemo_action
Created August 5, 2019 14:54
Action file for Nemo file browser which adds a context menu entry for Beyond Compare.
[Nemo Action]
#############################################
#### DEBUGGING:
####
#### Run Nemo with the environment
#### variable NEMO_ACTION_VERBOSE
#### set to get useful log output
#### for debugging your actions
####
@floriankraft
floriankraft / ajax-with-promise.ts
Created January 15, 2017 11:33
HTTP Request with Promises in Typescript
getRequest(url: string): Promise<any> {
return new Promise<any>(
function (resolve, reject) {
const request = new XMLHttpRequest();
request.onload = function () {
if (this.status === 200) {
resolve(this.response);
} else {
reject(new Error(this.statusText));
}
@floriankraft
floriankraft / bitbucket-initd.sh
Created November 18, 2016 17:03
Corrected init.d script for starting Bitbucket
#! /bin/sh
### BEGIN INIT INFO
# Provides: bitbucket
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Initscript for Atlassian Bitbucket Server
# Description: Automatically start Atlassian Bitbucket Server when the system starts up.
@floriankraft
floriankraft / CQ54RichtextDialog.xml
Created October 1, 2015 10:46
A default richtext dialog configuration for CQ 5.4.
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Widget" fieldLabel="Text" name="./text" xtype="richtext">
<linkbrowseConfig jcr:primaryType="nt:unstructured"
cssExternal="CQRTE__extlink" cssInternal="CQRTE__intlink"/>
<rtePlugins jcr:primaryType="nt:unstructured">
<edit jcr:primaryType="nt:unstructured"
features="[cut,copy,paste-plaintext,paste-wordhtml]" defaultPasteMode="plaintext"/>
<justify jcr:primaryType="nt:unstructured"
features=""/>
@floriankraft
floriankraft / SetMandatoryPropertyInAemDialog.js
Created May 22, 2015 07:20
Enable or disable the "mandatory" property of fields in an AEM (ExtJS) dialog.
// Can be called in (for example) a dialog by appending to a listener like "selectionchanged" (for a checkbox).
function (checkbox) { switchMandatoryFields(checkbox); }
// Enables or disables the "mandatory" property of the defined fields.
switchMandatoryFields = function(checkbox) {
"use strict";
var checkboxIsChecked = checkbox.optionItems.items[0].checked,
parentPanel = checkbox.findParentByType("tabpanel"),
firstTextfield = parentPanel.find("name", "./nameOfFirstTextfield")[0],
secondTextfield = parentPanel.find("name", "./nameOfSecondTextfield")[0];
@floriankraft
floriankraft / JavascriptModulePattern.js
Last active August 29, 2015 14:18
Scaffold for the Javascript Module Pattern.
var NamespaceName = NamespaceName || {};
NamespaceName.ModuleName = function () {
var aPublicProperty = "foo";
var aPrivateProperty = "bar";
var init = function () {
// some code here ...
};
@floriankraft
floriankraft / CustomAemSocialComponent.java
Last active August 29, 2015 14:17
Extending an AEM social component and factory.
package de.companyname.components.product.review;
import com.adobe.cq.social.commons.client.api.AbstractSocialComponentFactory;
import com.adobe.cq.social.commons.client.api.ClientUtilities;
import com.adobe.cq.social.commons.client.api.ClientUtilityFactory;
import com.adobe.cq.social.commons.client.api.QueryRequestInfo;
import com.adobe.cq.social.commons.client.api.SocialComponent;
import com.adobe.cq.social.commons.client.api.SocialComponentFactory;
import com.adobe.cq.social.commons.client.api.User;
import com.adobe.cq.social.commons.comments.api.CommentCollectionConfiguration;
@floriankraft
floriankraft / OsgiEventHandlerWithJobProcessor.java
Last active March 9, 2021 18:16
OSGi EventHandler for AEM replication events, which makes use of a JobProcessor to avoid blacklisting of the EventAdmin.
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.event.jobs.JobProcessor;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.day.cq.replication.ReplicationAction;
import com.day.cq.replication.ReplicationActionType;
@floriankraft
floriankraft / JcrQueryLibrary.md
Last active April 5, 2024 14:09
Some useful JCR queries (XPATH, SQL2) for AEM/CQ development.

SQL2

All nodes with a specific name

SELECT * FROM [nt:unstructured] AS node
WHERE ISDESCENDANTNODE(node, "/search/in/path")
AND NAME() = "nodeName"

All pages below content path