Skip to content

Instantly share code, notes, and snippets.

@floriankraft
floriankraft / idea.py
Created Oct 8, 2019
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.
View idea.py
#!/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 Aug 5, 2019
Action file for Nemo file browser which adds a context menu entry for Beyond Compare.
View beyond-compare.nemo_action
[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 Jan 15, 2017
HTTP Request with Promises in Typescript
View ajax-with-promise.ts
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 Nov 18, 2016
Corrected init.d script for starting Bitbucket
View bitbucket-initd.sh
#! /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 Oct 1, 2015
A default richtext dialog configuration for CQ 5.4.
View CQ54RichtextDialog.xml
<?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
Enable or disable the "mandatory" property of fields in an AEM (ExtJS) dialog.
View SetMandatoryPropertyInAemDialog.js
// 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 Aug 29, 2015
Scaffold for the Javascript Module Pattern.
View JavascriptModulePattern.js
var NamespaceName = NamespaceName || {};
NamespaceName.ModuleName = function () {
var aPublicProperty = "foo";
var aPrivateProperty = "bar";
var init = function () {
// some code here ...
};
@floriankraft
floriankraft / CustomAemSocialComponent.java
Last active Aug 29, 2015
Extending an AEM social component and factory.
View CustomAemSocialComponent.java
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 Mar 9, 2021
OSGi EventHandler for AEM replication events, which makes use of a JobProcessor to avoid blacklisting of the EventAdmin.
View OsgiEventHandlerWithJobProcessor.java
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 Jul 16, 2022
Some useful JCR queries (XPATH, SQL2) for AEM/CQ development.
View JcrQueryLibrary.md

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