This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--/* This is a 1x1 sized PNG */--> | |
<img class="ratio" alt="" aria-hidden="true" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="> | |
<!--/* This is a 2x1 sized PNG */--> | |
<img class="ratio" alt="" aria-hidden="true" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAABCAQAAABeK7cBAAAAC0lEQVR42mNkAAIAAAoAAv/lxKUAAAAASUVORK5CYII="> | |
<!--/* This is a 3x1 sized PNG */--> | |
<img class="ratio" alt="" aria-hidden="true" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAABCAQAAACx6dw/AAAAC0lEQVR42mNkAAMAAA4AAjOwv9wAAAAASUVORK5CYII="> | |
<!--/* This is a 4x3 sized PNG */--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* A very basic solution to add or replace a property and its value to a URL | |
* | |
* Usage example: | |
* url = replaceOrAddValue(url, "property_name", "value"); | |
* | |
* Source: https://gist.github.com/kevinweber/58a1b1bdcbab109018dc01a619f9b730 | |
*/ | |
function replaceOrAddValue(query, variable, value) { | |
var findVariable = variable + "=", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--/* 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# https://www.npmjs.com/package/aemsync | |
# Usage: Run `$ sh aemsync.sh` in your terminal from the folder where this script is located. | |
if ! type "aemsync" > /dev/null; | |
then | |
echo "aemsync is not installed. Installing..." | |
sudo npm install aemsync -g | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<sly data-sly-use.component="template.html" | |
data-sly-call="${component.template @ properties=properties}" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Throttle function | |
* based on https://remysharp.com/2010/07/21/throttling-function-calls | |
*/ | |
function throttle(fn, threshold, scope) { | |
threshold = threshold || 250; | |
var last, | |
deferTimer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts a given string so it can be used as the key of a JavaScript object. | |
* If no string is provided, a random string is generated. | |
*/ | |
function generateObjectKey(string) { | |
var key; | |
if (typeof string === "undefined") { | |
string = Math.random().toString(36).substr(2, 5); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See also: https://developers.google.com/web/tools/chrome-devtools/debug/command-line/events | |
monitorEvents(document.body); // logs all events on the body | |
monitorEvents(document.body, 'mouse'); // logs mouse events on the body | |
monitorEvents(document.body.querySelectorAll('input')); // logs all events on inputs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See: http://blogs.adobe.com/experiencedelivers/experience-management/htl-intro-part-3/ | |
<!--/* Accessing a value */--> | |
${properties['jcr:title']} | |
<!--/* Printing an array */--> | |
${aemComponent.names} | |
<!--/* Printing the array, separating items by ; */--> | |
${aemComponent.names @ join=';'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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:ClientLibraryFolder" | |
categories="[cq.authoring.dialog]"/> |