Skip to content

Instantly share code, notes, and snippets.

View toodooleedoo's full-sized avatar

Eric Soukenka toodooleedoo

View GitHub Profile
@toodooleedoo
toodooleedoo / README.md
Last active May 9, 2017 17:24
#AEM #SIGHTLY #SSJS JavaScript Use-API to append parameters and attributes to anchors

##Description

  1. Append two custom parameters to specific URL's entered by an Author.
  2. Open all links pointing outside your site inside a new window
  3. Add .html to links entered through the GUI pathfield widget (@adobe why is this not OOTB?)

##Use case When an Author selects a link via pathfield I found AEM is not adding the extension. I was going to add some Client Side JavaScript to my dialog windows to handle this on save however I also had the following business requests so I leveraged Server Side JavaScript to take care of all of this.

##Requirements

  • When a request is to domain1name.com or domain2name.com append 2 author controllable URL parameters used for Tracking which the authors could control Globally per site.
@toodooleedoo
toodooleedoo / acscommons_genericlist.html
Last active August 29, 2015 14:14
AEM Sightly ACS Commons Generic List Server Side
<div data-sly-use.conf="${'com.test.test2.util.CustomList' @ listname='configuration'}" data-sly-unwrap></div>
<ul>
<li>${conf.list.hello}</li>
<li>${conf.list.analytics @context='scriptString'}</li>
</ul>
@toodooleedoo
toodooleedoo / README.md
Last active April 21, 2016 13:43
#AEM #SIGHTLY #JAVASCRIPT ACS Commons Generic List get a value
@toodooleedoo
toodooleedoo / README.md
Last active June 23, 2017 13:38
#AEM #Sightly #SSJS Server Side JavaScript Use-API Breadcrumbs

###Description Retrieve a Page Object from all pages which are in the Site root then build a breadcrumb component and display the current pages title in a submenu.

###Use case Display a bar under eg a menu which displays the current pages title and functional breadcrumb components o the right.

##Requirements

  • Responsive and which works on all mobile devices and desktop.
  • Current pages title on the left
  • Breadcrumbs on the right
@toodooleedoo
toodooleedoo / README.md
Last active March 23, 2021 22:23
AEM Just playing with adding properties via Node

Playing with adding properties via CQ's Node API.

Not meant to be used as a production solution but gives some handy concepts.

@toodooleedoo
toodooleedoo / xpathloopplay.java
Last active June 18, 2017 01:52
#AEM #JAVA #JSP XPath Play
package org.main.test;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.day.cq.wcm.api.Page;
import javax.jcr.query.QueryManager;
import javax.jcr.query.Query;
import javax.jcr.query.QueryResult;
@toodooleedoo
toodooleedoo / sitemap.html
Created February 1, 2015 22:59
AEM Sightly Sitemap
<template data-sly-template.sitemap="${ @ page}">
<ul data-sly-list="${page.listChildren}">
<li>${item.title}<span data-sly-call="${sitemap @ page=item}"></span>
</li>
</ul>
</template>
<span data-sly-call="${sitemap @ page=currentPage}"></span>
@toodooleedoo
toodooleedoo / enfs.sh
Created February 1, 2015 23:13
Linux email in to evernote from command line. Requires Mutt setup.
TITLE="${1}"
CONTENT=${2}
if [ "${TITLE}" = "public" ]; then echo "Link: http://goo.gl/<<<CUT>>>";CONTENT="`date`: ${CONTENT}"; fi
if [ -f "${CONTENT}" ]; then
#Allowed extensions to send attachment and content
EXTENSION_MAP="sh"
if `grep -q "${CONTENT##*.}" <<<$EXTENSION_MAP`; then
mutt -s "${TITLE} (mailedin - ${CONTENT}) +" <<<CUT>>>@m.evernote.com -a ${CONTENT} <${CONTENT}
exit
@toodooleedoo
toodooleedoo / writer.php
Created February 1, 2015 23:15
PHP File writer. Just drop in file then call eg writer.php?file=myfile&data=stuff in file
<?php
$data=$_REQUEST['data'];
$file='files/'.$_REQUEST['file'];
$fh = fopen($file, 'a+') or die("can't open file");
if (flock($fh, LOCK_EX)) {
if(!empty($file)) {
echo '**** Writing to file: '.$file.' ';
echo "\n";
if(empty($data)) { $data=""; }
@toodooleedoo
toodooleedoo / README.md
Last active August 29, 2015 14:14
#LINUX Sickbeard download to Pushover

Monitors my local Sickbeard for new downloads and sends an alert if found.

While I understand this funcitonality exists within Sickbeard this gave me a bit more flexibility that I wanted to send show descriptions, change alert level, send to differet devices, etc.