Skip to content

Instantly share code, notes, and snippets.

View grantavery's full-sized avatar

Grant Avery grantavery

View GitHub Profile
@planecore
planecore / Coronavirus.js
Last active November 11, 2022 16:27
Coronavirus Scriptable Widget
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-green; icon-glyph: user-md;
// change "country" to a value from https://coronavirus-19-api.herokuapp.com/countries/
const country = "Israel"
const url = `https://coronavirus-19-api.herokuapp.com/countries/${country}`
const req = new Request(url)
const res = await req.loadJSON()
if (config.runsInWidget) {
const url = "https://xkcd.com/info.0.json"
const req = new Request(url)
const { img: imgUrl } = await req.loadJSON()
const imgReq = await new Request(imgUrl)
const img = await imgReq.loadImage()
// for development, displays the widget if run
const debug = false;
@miklosme
miklosme / scriptable.js
Last active October 29, 2020 10:59
Scriptable script to create a FiveThirtyEight forecast widget
const url = `https://projects.fivethirtyeight.com/2020-election-forecast/us_simulations.json`;
const req = new Request(url);
const res = await req.loadJSON();
if (config.runsInWidget) {
const biden = res[0].simulations.filter((x) => x.winner === 'Biden').length;
const trump = res[0].simulations.filter((x) => x.winner === 'Trump').length;
let widget = new ListWidget();
widget.backgroundColor = new Color('#000');
@brainno722
brainno722 / README.md
Last active July 25, 2024 01:50
Medium widget with circle assets

Circle info widgets

Instructions

  1. Install Scriptable for iOS
  2. Copy/Paste the code into a new file
  3. Adjust colors/font
  4. Add the script to a widget (medium)
  5. It should appear similar to the screenshots

Transparent/no background