Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Griffith rgriffith

View GitHub Profile
View site-footer.xsl
@rgriffith
rgriffith / tag_blocks_subscribing_to_dd.js
Last active Oct 12, 2018
Uses Cascade CMS REST API to iterate over XHTML/SD Blocks which subscribe to a specific Data Definition and adds a tag to each one.
View tag_blocks_subscribing_to_dd.js
// To install module, run: `npm i node-fetch`
const fetch = require("node-fetch");
const AUTHENTICATION = {username: '...', password: '...'};
const REST_API_URL = 'https://CASCADE_URL/api/v1/';
const SITE_NAME = 'www.example.com';
const DATA_DEFINITION_NAME = 'foo';
const TAG_TO_PUSH = 'bar';
@rgriffith
rgriffith / abbreviateHtmlString.vm
Last active Dec 20, 2015
Abbreviates a String which can contain html tags. Html tags are not counted in String length. It also try to handle open tags and html entities. Adopted from http://www.displaytag.org/1.2/displaytag/apidocs/org/displaytag/util/HtmlTagUtil.html
View abbreviateHtmlString.vm
#*
Abbreviates a String which can contain html tags. Html tags are not counted in String length. It also try to handle open tags and html entities.
Adopted from http://www.displaytag.org/1.2/displaytag/apidocs/org/displaytag/util/HtmlTagUtil.html
@param str full String. null is handled by returning null
@param maxLength maximum number of characters (excluding tags)
@param byNumberOfWords if true maxLength will be the number of words returned, elsewhere will represent the number of characters.
@return abbreviated String
*#