Skip to content

Instantly share code, notes, and snippets.

View okassa's full-sized avatar

Olympe KASSA okassa

View GitHub Profile
@okassa
okassa / AEM cURL
Created September 15, 2022 12:06 — forked from joemaffia/AEM cURL
AEM cURL commands
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
bundlefile=@"name of jar.jar" http://localhost:4505/system/console/bundles
Build a bundle
curl -u admin:admin -F bundleHome=/apps/centrica/bundles/name of bundle -F
descriptor=/apps/centrica/bundles/com.centrica.cq.wcm.core-bundle/name_of_bundle.bnd
@okassa
okassa / 1-standard.js
Created June 2, 2022 13:53 — forked from vladfr/1-standard.js
Use async/await and for..of in Cloud Firestore
// In a Firestore standard example, we quickly create a 'xmas tree' of nested stuff
// We use Promises directly: get().then(callback) and use snapshot.forEach() to iterate
let campaignsRef = db.collection('campaigns');
let activeCampaigns = campaignsRef.where('active', '==', true).select().get()
.then(snapshot => {
snapshot.forEach(campaign => {
console.log(campaign.id);
let allTasks = campaignsRef.doc(campaign.id).collection('tasks').get().then(
snapshot => {
snapshot.forEach(task => {
@okassa
okassa / ClientLibUseObject.java
Created April 1, 2022 12:47 — forked from nateyolles/ClientLibUseObject.java
Custom ClientLibUseObject Java-Use POJO to create custom HTML markup
package apps.clientlib_async.sightly.templates;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Collection;
import java.util.List;
import java.util.ArrayList;
import javax.script.Bindings;
@okassa
okassa / OakathonTest.java
Created March 29, 2022 10:16 — forked from trekawek/OakathonTest.java
Oakathon - oak plugins
package org.apache.jackrabbit.oak.jcr;
import java.util.concurrent.Executors;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import org.apache.jackrabbit.oak.api.CommitFailedException;
@okassa
okassa / ExtractAndSaveFormData.java
Created March 9, 2022 07:05 — forked from lesutton/ExtractAndSaveFormData.java
Setting and Getting Values from an AEM Workflow
package com.aem.workflowstep;
import com.adobe.granite.workflow.WorkflowException;
import com.adobe.granite.workflow.WorkflowSession;
import com.adobe.granite.workflow.exec.WorkItem;
import com.adobe.granite.workflow.exec.WorkflowData;
import com.adobe.granite.workflow.exec.WorkflowProcess;
import com.adobe.granite.workflow.metadata.MetaDataMap;
import org.osgi.framework.Constants;
import org.osgi.service.component.annotations.Component;
@okassa
okassa / renderPDFPreview.js
Created March 9, 2022 07:03 — forked from lesutton/renderPDFPreview.js
Render a PDF (or other) From An Adaptive Form Button
var postURL = "/rest/services/[Project]/RenderServices/renderXDPMultiple:1.0";
guideBridge.getDataXML({
success : function (guideResultObject) {
var xmlDataAsString = guideResultObject.data;
console.log(xmlDataAsString);
parser = new DOMParser();
xmlDoc = parser.parseFromString(xmlDataAsString,"text/xml");
afBoundData = xmlDoc.getElementsByTagName("FORM"); //This must be equal to your root element node
var oSerializer = new XMLSerializer();
if(this.value){
ValidateSSN(this.value);
}
function ValidateSSN(ssn)
{
if (/^\d{3}-\d{2}-\d{4}$/.test(ssn))
{
return (true);
}
@okassa
okassa / FilterInADropDown.js
Created March 9, 2022 07:00 — forked from lesutton/FilterInADropDown.js
Filter in an Adaptive Form Dropdown
if(searchFilter.value){
var filteredList = dropdownValues.filter(checkSearch);
filteredList;
} else {
dropdownValues;
}
function checkSearch(dropdownValue) {
var searchValue = searchFilter.value;
return valueIncludes(dropdownValue.toUpperCase(),searchValue.toUpperCase());
@okassa
okassa / ValidateFileNameBeforeSubmitting.js
Created March 9, 2022 06:59 — forked from lesutton/ValidateFileNameBeforeSubmitting.js
Validate File Name before submitting an Adaptive Form
var component = attachmentA; // Field whose value has changed
var fileItems = $('#'+component.parent.id).find(".guide-fu-fileItem");
for (i = 0;i<fileItems.length;i++) {
var filename = $(fileItems[i]).find(".guide-fu-fileName").text();
//check whether it is previously attached file or a newly attached one
console.log("filename: "+ filename);
if(filename!="helloworld.pdf"){
alert("You must correct your file name before submitting");
@okassa
okassa / adaptive_form_mandatory_indicator.css
Created March 9, 2022 06:59 — forked from lesutton/adaptive_form_mandatory_indicator.css
Add a mandatory "star" indicator to the end of all the field labels of an adaptive form.
div[data-mandatory*="true"] .guideFieldLabel label::after {
content: "*";
color: red;
}