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
let url = "https://sports-data.api.tv2.dk/sports-data-backend/cycling/stages/1720933/standings" | |
let req = new Request(url) | |
req.headers = { "Accept": "application/json" } | |
let json = await req.loadJSON() | |
let rawStandings = json["cyclingGeneralStandings"] | |
let standings = rawStandings.map(mapStanding) | |
let table = formatStandings(standings) | |
QuickLook.present(table) | |
if (config.runsWithSiri) { | |
let tts = siriText(standings) |
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
let date = new Date() | |
let y = ""+date.getFullYear() | |
let m = ""+(date.getMonth() + 1) | |
let d = ""+date.getDate() | |
let dateStr = y+"-"+zeroPrefix(m)+"-"+zeroPrefix(d) | |
let siriArgs = args.siriShortcutArguments | |
let channelId = siriArgs.channel | |
let channelIds = [] | |
if (channelId != null) { | |
channelIds = [channelId] |
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
let windowStart = new Date() | |
let windowEnd = new Date() | |
windowStart.setHours(19) | |
windowStart.setMinutes(00) | |
windowStart.setSeconds(00) | |
windowEnd.setHours(21) | |
windowEnd.setMinutes(30) | |
windowEnd.setSeconds(00) | |
let channelIds = [ | |
"1", // DR1 |
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 order to use the script, | |
// you must create a Slack bot | |
// with the user:read scope and | |
// generate an accesss token. | |
// The script will prompt you | |
// to copy the access token in. | |
// The token is stored securely | |
// in the keychain. | |
let containers = await ContactsContainer.all() | |
let contacts = await Contact.all(containers) |
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
let url = "https://xkcd.com/info.0.json" | |
let req = new Request(url) | |
let json = await req.loadJSON() | |
let imgURL = json["img"] | |
alt = json["alt"] | |
req = new Request(imgURL) | |
let img = await req.loadImage() | |
QuickLook.present(img) | |
if (config.runsWithSiri) { | |
Speech.speak(alt) |
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 order to use the script, you must create a Slack bot with the user:read scope and generate an accesss token. | |
// The script will prompt you to copy the access token in. | |
// The token is stored securely in the keychain. | |
let containers = await ContactsContainer.all() | |
let contacts = await Contact.all(containers) | |
let slackUsers = await loadSlackUsers() | |
slackUsers = slackUsers.filter(u => { | |
return !u["is_bot"] | |
&& !u["deleted"] | |
&& !u["is_restricted"] |
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
// Variables used by Scriptable. | |
// These must be at the very top of the file. Do not edit. | |
// icon-color: blue; icon-glyph: snowflake; | |
let html = await loadHTML() | |
let stickyItems = getStickyItems(html) | |
let liftCounts = getLiftCounts(stickyItems[1]) | |
let slopeCounts = getSlopeCounts(stickyItems[2]) | |
let snowDepth = getSnowDepth(stickyItems[3]) | |
let windSpeed = getWindSpeed(stickyItems[4]) | |
let tableTexts = [ |
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
let tag = args.shortcutParameter | |
let fm = FileManager.iCloud() | |
let filePath = args.fileURLs[0] | |
fm.removeTag(filePath, tag) | |
let tags = fm.allTags(filePath) | |
let output = {"tags": tags} | |
Script.setShortcutOutput(output) | |
Script.complete() |
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
let tag = args.shortcutParameter | |
let fm = FileManager.iCloud() | |
let filePath = args.fileURLs[0] | |
fm.addTag(filePath, tag) | |
let tags = fm.allTags(filePath) | |
let output = {"tags": tags} | |
Script.setShortcutOutput(output) | |
Script.complete() |
OlderNewer