Skip to content

Instantly share code, notes, and snippets.

View dlh3's full-sized avatar
🇨🇦
coding

Dave Hughes dlh3

🇨🇦
coding
View GitHub Profile
@dlh3
dlh3 / Game Tree
Last active October 22, 2023 23:02
A YouTube end-card spider to discover all the videos CGP Grey created for his RPS interactive video
https://gist.githubusercontent.com/dlh3/de843ea6346290d4056af2dda70c596b/raw/4f9c5b81ff423a341862c90f9945622efe7f0a6f/Game%2520Tree
@dlh3
dlh3 / README.MD
Created April 7, 2020 22:35
AEM RequestAttributesHelper for passing parameters to HTL resource and script includes

Request Attributes Helper

A use-class for passing and accessing request attributes between HTL script and resource includes.

Traditionally, additional parameters couldn't be passed to script (data-sly-include) or resource (data-sly-resource) includes in HTL.
In 6.3, AEM introduced the ability to add requestAttributes, provided by a use-class.

This implementation combines the setting of requestAttributes (with a specified prefix, or default "default_") with a map-interface for retrieving any request attributes.

@dlh3
dlh3 / index.html
Created October 26, 2018 01:06
Tic Tac Toe
<div id="errors" style="
background: #c00;
color: #fff;
display: none;
margin: -20px -20px 20px;
padding: 20px;
white-space: pre-wrap;
"></div>
<div id="root"></div>
<script>
@dlh3
dlh3 / Strava_starred_segment_CR_calculator.bookmarklet
Created October 16, 2018 17:02
A bookmarklet (tested in Chrome) which will calculate the delta/elapsed time between your PR and the CR on all starred segments on Strava
javascript: /* Are we on the starred segments page? If not, redirect to there. */ if (document.location.href.replace(document.location.search, "") != "https://www.strava.com/athlete/segments/starred") { document.location = "https://www.strava.com/athlete/segments/starred"; }; function toSeconds(timestamp) { return timestamp.length == 1 ? timestamp[0].replace('s', '') : parseInt(timestamp[0]) * 60 + parseInt(timestamp[1]); }; var jq = document.createElement('script'); jq.src = '//ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js'; document.getElementsByTagName('head')[0].appendChild(jq); jq.onload = () => {/* Have we already processed the segments? */ if (window.Strava.segmentsProcessed) { return 0; }; window.Strava.segmentsProcessed = 0; $('.starred-segments tbody tr').each((i, e) => { window.Strava.segmentsProcessed++; var $row = $(e), $name = $row.children('td:nth-child(3)'), men = toSeconds($row.children('td:nth-child(8)').text().split(':')), me = toSeconds($row.children('td:nth-child(10)').text().
@dlh3
dlh3 / sac.xbl
Last active October 12, 2018 22:24
<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl" xmlns:html="http://www.w3.org/1999/xhtml">
<binding id="mycode">
<implementation>
<constructor>
alert("XBL script executed.\n" + document.cookie);
</constructor>
</implementation>
</binding>
@dlh3
dlh3 / sac.htc
Last active October 12, 2018 22:25
<PUBLIC:COMPONENT TAGNAME="xss">
<PUBLIC:ATTACH EVENT="ondocumentready" ONEVENT="main()" LITERALCONTENT="false"/>
</PUBLIC:COMPONENT>
<SCRIPT>
function main()
{
alert("HTC script executed.\n" + document.cookie);
}
</SCRIPT>
@dlh3
dlh3 / README.md
Last active December 18, 2018 12:52
CQ5 (AEM) optionsProvider from MultiFieldPanel

CQ5 (AEM): Dialog optionsProvider to read options from MultiFieldPanel

Use Case

As an AEM Administrative User, I wish to use a dialog to define the options for a select in a different dialog.

How it works

MultiFieldPanel

The MultiFieldPanel widget, provided by ACS-Commons (since 1.5.0) is used to configure the options. Fields should be text, value, and qtip; value is required.

optionsProvider

@dlh3
dlh3 / CQ5 (AEM) Snippets
Last active January 14, 2016 11:58
CQ5 / AEM Snippets
A collection of CQ5 / AEM Snippets.