Skip to content

Instantly share code, notes, and snippets.

@gwthompson
gwthompson / Cheerlights.js
Created February 5, 2021 00:56 — forked from anilkpatro/Cheerlights.js
Cheerlights Scriptable script
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: gray; icon-glyph: magic;
// CHEERLIGHTS
// https://cheerlights.com/
// The size of the widget preview in the app - "small", "medium" or "large"
const widgetPreview = "small";
@gwthompson
gwthompson / code.py
Created December 21, 2020 20:52 — forked from dglaude/code.py
Change the MagTag program you want to run at startup.
# This file should be saved as code.py
# At MagTag startup (or at wakeup time), keep one one of the 4 button pressed.
# The MagTag will switch to the program you choose and remember that decision at each wakeup.
# The trick is to have for each button one CircuitPython program to import.
# You can customise the app_to_start list, here is the current setting:
# no button => magtag_weather
# 1 (D15) => magtag_showtimes
# 2 (D14) => magtag_tree
# 3 (D12) => magtag_spacex
# 4 (D11) => magtag_year_progress_percent
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e
// by @levelsio
// HOW TO
// 1) Make a Google Sheet, we'll pull the first cell e.g. A1
// 2) Publish your Google Sheet, File -> Publish To Web
// 3) Copy the SHEET_ID in the URL, put it in here below:
const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json"
// 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188
// 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc)
@gwthompson
gwthompson / running.js
Created November 19, 2020 14:44 — forked from matkoenig/running.js
Running Scriptable
// Running 1.0 | Matthias Konig | 02.11.2020
/*------------------------------------------------------------------------------
Hauptprogramm
------------------------------------------------------------------------------*/
// Konstanten
const maxYearDist = 1500;
const maxMonthDist = 200;
const color1 = Color.orange();
@gwthompson
gwthompson / bbc2-playlist.js
Created November 16, 2020 14:16 — forked from marco79cgn/bbc2-playlist.js
A custom iOS widget that shows the last 5 songs from BBC2 radio and plays them in Spotify (for Scriptable.app)
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: red; icon-glyph: music;
// insert your Spotify client id and secret here
const clientId = "xxx"
const clientSecret = "xxx"
let widget = new ListWidget()
widget.setPadding(22,10,10,10)
// These three lines demonstrate how this code works.
let img = await Photos.fromLibrary()
let newImg = await processImage(img)
QuickLook.present(newImg)
// This function takes an image and returns a processed image.
async function processImage(image) {
const imageId = "imageId"
const canvasId = "canvasId"
@gwthompson
gwthompson / DiscordWidget.js
Created October 13, 2020 23:12 — forked from heptal/DiscordWidget.js
Recent Discord channel/DM messages shown in iOS14 widget - built with Scriptable.app
// set up keychain and token
const namespace = "dscrd.wdgt"
const token = `${namespace}.usertoken`
if (!Keychain.contains(token) || !Keychain.get(token)) {
let alert = new Alert()
alert.title = "Enter Discord User Token"
alert.addTextField("<discord_token>")
await alert.presentAlert()
Keychain.set(token, alert.textFieldValue(0) || "")
}
@gwthompson
gwthompson / scriptable.js
Created October 12, 2020 00:53 — forked from danielbuechele/scriptable.js
Covid Widget
const url = `https://api.coronavirus.data.gov.uk/v1/data?filters=areaName=United%2520Kingdom;areaType=overview&latestBy=newCasesByPublishDate&structure=%7B%22date%22:%22date%22,%22value%22:%22newCasesByPublishDate%22%7D`
const req = new Request(url)
const res = await req.loadJSON()
if (config.runsInWidget) {
let widget = createWidget(res.data[0].value, new Date(res.data[0].date))
Script.setWidget(widget)
Script.complete()
}
@gwthompson
gwthompson / S10桌面小组件.js
Created October 9, 2020 21:21 — forked from BlueSky-07/S11桌面小组件.js
英雄联盟 S10 x iOS 14 桌面小组件 | Scriptable
/**
* S10 桌面小组件
* Author : BlueSky
* Version : 2.0-201009
* API : https://tiyu.baidu.com/match/S10
* Gist : https://gist.github.com/BlueSky-07/70bcfedc4e5fe7fcf1b06db48124fffe
* Readme : https://sspai.com/post/62980
*/
/**
@gwthompson
gwthompson / aqi.js
Created October 9, 2020 18:52 — forked from jonsadka/aqi.js
Customized AQI Widget
"use strict";
/**
* This widget is from <https://github.com/jasonsnell/PurpleAir-AQI-Scriptable-Widget>
* By Jason Snell, Rob Silverii, Adam Lickel, Alexander Ogilvie, and Brian Donovan.
* Based on code by Matt Silverlock.
*/
const API_URL = "https://www.purpleair.com";