Skip to content

Instantly share code, notes, and snippets.


Saulo Venancio saulovenancio

View GitHub Profile
saulovenancio /
Created Apr 12, 2020 — forked from wojteklu/
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.

General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

saulovenancio / component.html
Created Dec 30, 2019 — 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.
View component.html
<sly data-sly-use.component="template.html"
data-sly-call="${component.template @ properties=properties}" />
View Generic List Usage Author dialog Touch and classic
<jcr:root xmlns:cq="" xmlns:jcr=""
fieldLabel="Social Service"
View aemTouchUIValidation.js
var $input = $('.my-input-field'),
errorMessege = 'This field is required';
if ($input.willValidate()) {
$input.checkValidity(); // true
$input.validationMessage(); // ''
/* Set input field as invalid */
$input.checkValidity(); // false
View demo.less
// USE
.font-face(Ubuntu-Regular, '', 400, normal);
.font-face(Ubuntu-Italic, '', 400, italic);
.font-face(Ubuntu-Bold, '', 700, normal);
.test {
.font(Ubuntu-Regular, 1em, normal, normal);
h1 {
.font(Ubuntu-Bold, 1.7em, bold, normal);
View buttongroup.xml
<alignment jcr:primaryType="nt:unstructured"
fieldLabel="Alignment of components"
<items jcr:primaryType="nt:unstructured">
<default jcr:primaryType="nt:unstructured"
saulovenancio /
Created Mar 7, 2018 — forked from andrewmkhoury/
Migrating AEM Users, Groups and ACLs between instances
  1. Migrate users and groups (If users were not imported automatically via LDAP) Package users and groups (2 separate packages) on the old system (excluding admin and anonymous OOTB users)
    1. Go to CRXDE lite app /crx/de/index.jsp and log in as admin user (on the old system)
    2. Go to "Tools" => "Query"
    3. In the bottom "Query" box enter this query to find the admin user: /jcr:root/home/users//element(*,rep:User)[@rep:principalName="admin"]
    4. Click "Execute" and copy the path of the admin user node in the results to a text file
    5. Repeat step 3 with a query for anonymous user: /jcr:root/home/users//element(*,rep:User)[@rep:principalName="anonymous"]
    6. Click "Execute" and copy the path of the anonymous user node in the results to a text file (so now you should have two paths, one for "admin" and one for "anonymous")
saulovenancio /
Created Mar 5, 2018 — forked from nateyolles/
AEM/CQ cURL: Adding include/exclude rules to package filters
# Adding include/exclude rules to CQ/AEM package filters through cURL.
# Through a simple search, you will find numerous lists of CQ/AEM cURL commands.
# However, I haven't seen an example of adding rules to package filters. The
# JSON "rules" key takes an array value. You can leave the array empty if you
# don't need to include any rules. The array is of JSON objects with a
# "modifier" key and value of "include" or "exclude", and a "pattern" key with
# your path or regular expression as the value.
# create package
saulovenancio / .content.xml
Created Feb 16, 2018 — forked from nateyolles/.content.xml
AEM using Granite Render Conditions
View .content.xml
<items jcr:primaryType="nt:unstructured">
fieldLabel="This always shows"
fieldLabel="This only shows when header &quot;User-Agent&quot; contains &quot;chrome&quot;"
saulovenancio / .content.xml
Created Feb 16, 2018 — forked from nateyolles/.content.xml
AEM Expression Language
View .content.xml
You can’t perform that action at this time.