Skip to content

Instantly share code, notes, and snippets.

View Surajkamdi's full-sized avatar
:octocat:
Tracking You...

Suraj Kamdi Surajkamdi

:octocat:
Tracking You...
View GitHub Profile
@Surajkamdi
Surajkamdi / moment-js-timezones.txt
Created August 23, 2022 07:34 — forked from diogocapela/moment-js-timezones.txt
List of All Moment.js Timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
@Surajkamdi
Surajkamdi / AemResourceResolutionServlet.java
Created May 17, 2021 14:08 — forked from nateyolles/AemResourceResolutionServlet.java
Get the HTML markup for a resource in AEM / CQ.
package com.nateyolles.aem;
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;
@Surajkamdi
Surajkamdi / logic.js
Created May 17, 2021 14:07 — forked from gabrielwalt/logic.js
Read AEM runmodes from Sightly
var SlingSettingsService = Packages.org.apache.sling.settings.SlingSettingsService;
use(function () {
// Get runmodes and transform them into an object that is easier to read for Sightly
var runmodesObj = {};
var runmodesSet = sling.getService(SlingSettingsService).getRunModes();
var iterator = runmodesSet.iterator();
while (iterator.hasNext()) {
runmodesObj[iterator.next()] = true;
/* This OSGi service listens for events and creates a job for each one matching some conditions. */
@Component
@Service
@Properties({
// choose appropriate topic values
@Property(name = EventConstants.EVENT_TOPIC, value = {
SlingConstants.TOPIC_RESOURCE_CHANGED,
SlingConstants.TOPIC_RESOURCE_ADDED,
SlingConstants.TOPIC_RESOURCE_REMOVED
})
@Surajkamdi
Surajkamdi / dispatcher.any
Created May 17, 2021 14:06 — forked from knennigtri/dispatcher.any
We.Retail dispatcher.any and httpd.conf
#To find the We.Retail Specific changes, search for "We.Retail Alert"
# Each farm configures a set of load balanced renders (i.e. remote servers)
/farms
{
# First farm entry
/website
{
# Request headers that should be forwarded to the remote server.
/clientheaders
@Surajkamdi
Surajkamdi / .content.xml
Created May 17, 2021 14:06 — forked from briankasingli/.content.xml
AEM 6.4 RichText Editor - Enable all features, and disable inline full screen option; the inline fullscreen option causes too many problems.
<?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:primaryType="cq:Component"
jcr:title="Rich Text"
sling:resourceSuperType="core/wcm/components/text/v2/text"
componentGroup="General"/>
@Surajkamdi
Surajkamdi / reloadOnLayerSwitch.js
Created May 17, 2021 14:06 — forked from badvision/reloadOnLayerSwitch.js
AEM 6.x: Reload the page when the user switches layers
// This must be in a client library with the category cq.authoring.editor.hook
/* global Granite, jQuery, document */
(function ($, channel) {
'use strict';
$(function () {
var loadedTime = new Date();
channel.on('cq-layer-activated', function (event) {
if (event.prevLayer && event.layer !== event.prevLayer) {
var eventTime = new Date();
if (event.prevLayer !== 'Annotate' && event.layer !== 'Annotate' && (eventTime - loadedTime) > 1500) {
@Surajkamdi
Surajkamdi / React Join Children
Created March 4, 2020 05:08 — forked from granmoe/ React Join Children
Ever wanted to join react children like you join an array?
This file is only here to provide the title of the gist
@Surajkamdi
Surajkamdi / Sightly Pattern "Inline List"
Created September 19, 2018 09:50 — forked from kevinweber/Sightly Pattern "Inline List"
AEM/HTL: Define a list/array within a HTL template (and avoid redundant code!)
<!--/* We can define a list within a Sightly template to avoid redundant code */-->
<sly data-sly-test.versions="${['desktop', 'mobile']}"/>
<sly data-sly-list.identifier="${versions}">
<div class="element ${identifier}">Repeated content</div>
</sly>
@Surajkamdi
Surajkamdi / component.html
Created September 19, 2018 09:50 — forked from kevinweber/component.html
HTL/Sightly: "Use and call template" pattern. Put template into separate file for reusability, and pass parameters when calling it. Note that in most cases it's not necessary to pass "properties" to the template because they work even if they're not passed explicitly.
<sly data-sly-use.component="template.html"
data-sly-call="${component.template @ properties=properties}" />