Skip to content

Instantly share code, notes, and snippets.

View craigtommola's full-sized avatar

Craig Tommola craigtommola

View GitHub Profile
@craigtommola
craigtommola / code.gs
Last active February 26, 2018 19:47
Quickstart: GAS Calendar - US Holidays
function doGet() {
var calendarId = 'en.usa#holiday@group.v.calendar.google.com'; // Public calendar we're connecting to
var optionalArgs = { // See optionalArgs at http://bit.ly/GAScal_eventlist
timeMin: (new Date()).toISOString(), // Setting today as the minimal time requirement
showDeleted: false, // Only show active events
singleEvents: true, // Return recurring events as individual events
maxResults: 10, // Max of 10 records
orderBy: 'startTime' // Order chronologically
};
var response = Calendar.Events.lis
@craigtommola
craigtommola / code.gs
Last active March 1, 2018 14:47
GAS Calendar - Pitchfork Basic
function doGet() {
var root = XmlService.createElement('CALENDAR'); // Set variable "root" equal to a new node of our XML structure named CALENDAR
var calendarId = '0e7imu3th31s61s05p0kthvup4@group.calendar.google.com'; // Public calendar we're connecting to
var calendar = CalendarApp.getCalendarById(calendarId); // Connection to Calendar
var calendarName = calendar.getName(); // Set variable "calendarName" equal to the calendar.getName value
var calendarDesc = calendar.getDescription(); // Set variable "calendarDesc" equal to the calendar.getDescription value
var optionalArgs = { // Parameters to filter results. See all parameters at https://bit.ly/GAScal_eventlist
timeMin: (new Date()).toISOSt
@craigtommola
craigtommola / code.gs
Last active March 27, 2018 20:49
GAS Sheet: Pitchfork Complex
function doGet() {
var root = XmlService.createElement('CALENDAR');
var CALENDAR = SpreadsheetApp.openById('18S7Jvc5xQE-Bx2yOpLlebIyhTzjyR845lNFHjscV8ss');
var data = CALENDAR.getDataRange().getValues();
for (var i = 1; i < data.length; i++) {
var child = XmlService.createElement('EVENT')
var NAME = XmlService.createElement('NAME')
.setText(data[i][0]);
var LINK = XmlService.createElement('LINK')
@craigtommola
craigtommola / config.xml
Last active April 16, 2018 16:08
OU Insights Page Report
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<entry key="title">Page Accessibility</entry>
<entry key="icon" private="true">page-accessibility-report.png</entry>
<entry key="description">View page accessibility errors.</entry>
<entry key="types" private="true">sidebar</entry>
<entry key="initial_height" private="true">600</entry>
<entry key="support_email" label="Support Email" overwritable="true">web@college.edu</entry>
</config>
@craigtommola
craigtommola / OU Publish Trigger
Created January 17, 2019 21:08
OU Publish Trigger
<parameter name="s-tag" prompt="Publish Trigger" type="filechooser" dependency="s-tag"> </parameter>
@craigtommola
craigtommola / beastie-boys.xml
Last active April 16, 2019 17:31
OUTC19: Beastie Boys
<?xml version="1.0"?>
<BB_TOP_TEN>
<TRACK>
<TRACK_NAME>(You gotta) Fight for Your Right (to Party)</TRACK_NAME>
<ALBUM_NAME>License to Ill</ALBUM_NAME>
<ALBUM_YEAR>1986</ALBUM_YEAR>
<RRHOF_DESC>After years performing as a hardcore punk act, the Beastie Boys – ADROCK, MCA and Mike D – recast themselves as rap innovators. It was an especially unlikely move for three middle-class white kids from New York City, but it was a sonic shift that created a stir. Leading the charge was "(You Gotta) Fight For Your Right (To Party!)" from 1986's Licensed To Ill. Produced by friend and label head Rick Rubin, the song combined heavy metal swagger, rap brio and the Beastie Boys' ill-bred humor.</RRHOF_DESC>
</TRACK>
<TRACK>
<TRACK_NAME>Brass Monkey</TRACK_NAME>
@craigtommola
craigtommola / nirvana-feed.xsl
Last active April 16, 2019 17:32
OUTC19: Nirvana
<!-- I put this in my template-matches-outc.xsl file -->
<xsl:template name="loadNirvanaFeed">
<xsl:variable name="feed-path" select="ouc:properties[@label='config']/parameter[@name='xml-feed']"/>
<xsl:if test="unparsed-text-available(concat($domain, $feed-path))">
<xsl:variable name="nirvanaFeed" select="document(concat($domain, $feed-path))"/>
<h2>Ten Essential Nirvana Songs</h2>
<xsl:for-each select="$nirvanaFeed/NIRVANA_TOP_TEN/TRACK">
<h4><xsl:copy-of select="TRACK_NAME/node()" /></h4>
<p><em><xsl:copy-of select="ALBUM_NAME/node()" /></em>, <xsl:copy-of select="ALBUM_YEAR/node()" /></p>
<p><xsl:copy-of select="RRHOF_DESC/node()" /></p>
@craigtommola
craigtommola / radiohead-feed.xsl
Created April 12, 2019 17:33
OUTC19: Radiohead
<xsl:template match="loadRadioheadFeed" name="loadRadioheadFeed">
<xsl:variable name="feed-path"><xsl:text>/_showcase/craigdev/outc19demo/radiohead.xml</xsl:text></xsl:variable>
<xsl:if test="unparsed-text-available(concat($domain, $feed-path))">
<xsl:variable name="radioheadFeed" select="document(concat($domain, $feed-path))"/>
<h2>Radiohead Discography</h2>
<xsl:for-each select="$radioheadFeed/RADIOHEAD/ALBUM">
<img class="album-art">
<xsl:attribute name="src">
<xsl:value-of select="ALBUM_ART/node()" />
</xsl:attribute>
@craigtommola
craigtommola / conditionalOutputCSS.xsl
Last active April 16, 2019 17:32
OUTC19: Bonus Tracks
<!-- This is an example, based on the use of the Hope College "Expand All Accordions" Asset -->
<!-- The concept is "If the PCF file contains specific content, then output a link to CSS file on publish." -->
<!-- This is the asset content -->
<div class="expand-button-wrapper">
<button id="expandAll" class="expand-all"><span class="expand-all-button-icon">&nbsp;</span> <span class="expand-button-text">Expand All</span></button>
</div>
<!-- Add to your /_resources/xsl/common.xsl or equivalent file, just before the closing </head> tag -->
<xsl:if test="/document/ouc:div[@label='maincontent']/descendant::button[@id='expandAll']”>
@craigtommola
craigtommola / entry-header-snippet.php
Last active July 31, 2019 14:55
Wordpress Twenty Nineteen theme + ACF = Custom Byline
<!-- /template-parts/header/entry-header.php
Create ACF field for posts with text field named Custom Byline / custom_byline
Replace entry-header.php:16 with the below code
-->
<?php if (get_field('custom_byline') === '') { twentynineteen_posted_by(); } else { $custom_author = get_field('custom_byline'); echo '<span class="byline">
<svg class="svg-icon" width="16" height="16" aria-hidden="true" role="img" focusable="false" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"></path>
<path d="M0 0h24v24H0z" fill="none"></path>
</svg>
<span class="screen-reader-text">Authored by</span><span class="author vcard">'.$custom_author.'</span>