This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* createTOC */ | |
// This script updates a table of contents for your document. It assumes your document is using | |
// sections, as each section will be an entry in the TOC | |
// Please view the "sample" page for this script in the file | |
// This script also adds section numbers to section and page headers and names the docPage's frame | |
// Along the way it sorts the docPages and page-numbers them, using other scripts in this file. | |
// See the other scripts for code comments on them |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {toArray} = require('util'); | |
// returns a timestamp | |
const timeStamp = () => { | |
const now = new Date(); | |
return `${'0'.concat(now.getHours()).slice(-2)}:${'0'.concat(now.getMinutes()).slice(-2)}:${'0'.concat(now.getSeconds()).slice(-2)}.${now.getMilliseconds().toString().concat('000').slice(0,3)}`; | |
} | |
// Assumes an existing text layer called 'debug_output' on the current page that's NOT in a group or artboard | |
// parameters: the Sketch page object, the thing (or an array of things) to log, whether or not to clear previous logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
artworks = | |
card1: | |
title: "Beach" | |
x: 40 | |
card2: | |
title: "Turtle" | |
x: 50 | |
_.forEach artworks, (value, key) -> | |
print value.title, value.x, key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in design mode there is a Frame called "template" (targeted for code). In template there is a text layer | |
# called "title" (not targeted for code) and a layer called "thumbnail" (also not targeted). You can see how | |
# much using Symbols simplifies the code, and to change the layout, you just change it in design. | |
{Symbol} = require "symbols/Symbol" | |
Template = Symbol template # create Template class out of the frame "template" defined in Design | |
# Handles the JSON | |
getData = "https://api.rss2json.com/v1/api.json?rss_url=http%3A%2F%2Furbansharp.com%2Frss%2F" |