Skip to content

Instantly share code, notes, and snippets.

@Normal-Tangerine8609
Normal-Tangerine8609 / calendar.js
Created October 4, 2022 10:39
A small script to jumpstart your calendar widget.
/*
* SIMPLE CALENDAR BOILERPLATE
* this is not meant to be a stantalone widget but to be a starter template to jumpstart your calendar widget (or any widget with a calendar).
* dates can be difficult to work with, so this template is here to make it easier
*/
/*
* BASE WIDGET STYLING
* change the below variables to customize your calendar style
*/
@Normal-Tangerine8609
Normal-Tangerine8609 / progress-circle.js
Last active February 16, 2024 18:28
This is a function that allows you to create simple circular progress bars for widgets. It creates the image of the progress circle using `WebView` and the canvas element. The image is then set to the background image of a stack with padding applied so you can put any widget element within the circle.
/*
* progressCircle(on: Stack or Widget, value: number, colour: string, background: string, size: number, barWidth: number) : Promise<Stack>
*
* PARAMS
* on - the stack or widget to add the progress circle to
* value - a number between 1 and 100 to be the circle percentage or a number between 0 and 1 to be the circle percentage
* colour - a HTML supported (hex, rgb, hsl) colour for the progress of the circle. Alternitively, it can be two HTML supported colours seperated by a hyphen (white-black) for the first colour to be active on light mode and second on dark mode
* background - a HTML supported (hex, rgb, hsl) colour for the unfilled progress of the circle. Alternitively, it can be two HTML supported colours seperated by a hyphen (white-black) for the first colour to be active on light mode and second on dark mode
* size - the size of the progress circle
* barWidth - the width of the circular progress bar
@Normal-Tangerine8609
Normal-Tangerine8609 / rss.js
Last active September 11, 2023 10:30
Simple Scriptable RSS Feed Parser (XML)
function parseXML(string) {
/*
* Part 1
*
* Parse the xml into a DOM-like json
*
* Input: <tag attribute="value">text node<inline>text node</inline>text node</tag>
*
* Output:
* {
@Normal-Tangerine8609
Normal-Tangerine8609 / html-gradient.js
Created January 17, 2022 01:38
Scriptable HTML Gradient
/*
* HTMLGradient
*
* HTMLGradient(gradient: string): Promis<gradient>
*
* example
* ------------
* const widget = new ListWidget()
* widget.backgroundGradient = await HTMLGradient("to left, red, green 25%, blue-yellow")
* widget.presentSmall()
@Normal-Tangerine8609
Normal-Tangerine8609 / horizontal-rule.js
Created December 9, 2021 12:19
Add Horizontal Rules To Scriptable Widgets
/*
Call
ListWidget.addHr()
WidgetStack.addHr()
Return
WidgetHorizontalRule
Properties
color: Color