Skip to content

Instantly share code, notes, and snippets.

View supermamon's full-sized avatar

Raymond Velasquez supermamon

View GitHub Profile
@simonbs
simonbs / XcodeReleases.js
Last active November 14, 2022 01:50
Sample app that lets you browse Xcode releases. Depends on ScriptUI, my yet-to-be-releases project for building native SwiftUI interfaces in JavaScript.
UI.view = RootView()
function RootView() {
const [isLoading, setLoading] = createSignal(true)
const [xcodeGroups, setXcodeGroups] = createSignal([])
fetchXcodes().then((xcodes) => {
setLoading(false)
setXcodeGroups(groupXcodes(xcodes))
})
@Normal-Tangerine8609
Normal-Tangerine8609 / progress-circle.js
Last active May 9, 2024 11:22
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
@Kynako
Kynako / chainable.js
Created September 23, 2021 03:44
Generate classes that can use method chaining from built-in classes.
/*
# Usage
const chainable = importModule('chainable')
// generate a class that can use method chaining.
const ChainableAlert = chainable('Alert')
// construct instance
@kevinkub
kevinkub / scriptable-line-chart.js
Last active February 1, 2024 15:18
Simple line chart class for https://scriptable.app 📈
class LineChart {
// LineChart by https://kevinkub.de/
constructor(width, height, values) {
this.ctx = new DrawContext();
this.ctx.size = new Size(width, height);
this.values = values;
}
_calculatePath() {
@saiteja09
saiteja09 / StockWidget.js
Last active July 13, 2023 03:47
Stock Widget for iOS using Scriptable
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-blue; icon-glyph: book; share-sheet-inputs: plain-text;
// Stock Ticker Widget
let stocksInfo = await getStockData()
let widget = await createWidget()
if (config.runsInWidget) {
// The script runs inside a widget, so we pass our instance of ListWidget to be shown inside the widget on the Home Screen.
Script.setWidget(widget)
} else {
@hi94740
hi94740 / Scriptable-chainWidget.js
Last active February 17, 2024 11:04
Chainable widget API for Scriptable App.
// Copy the function below to use in your scripts.
function createWidget() {
const widget = new ListWidget()
const wrap = (view, isWidget) => {
let wrapped
const wrapWith = (key, exec) => [key, (...args) => (exec(...args), wrapped)]
wrapped = Object.fromEntries(Object.keys(view).map(key => {
if (typeof view[key] === "function") {
if (key.startsWith("add")) return wrapWith(key, (...args) => {
let cb
@simonbs
simonbs / Slack Status.js
Last active November 23, 2021 02:37
Peforms OAuth flow against Slack and sets a Slack Status. Meant to be used with Shortcuts.
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: pink; icon-glyph: user;
// In order to use the script, you must create a Slack app and install it on your workspace. Go here to create your app: api.slack.com/apps
// There's two important configurations you must make to the app:
// 1. Add the users.profile:write scope to the app. This scope is necessary to set a Slack status.
// 2. Add the following redirect URL, so Slack will redirect to Scriptable after authorizing.
// https://open.scriptable.app
// Run the script to grant your newly created app authorization to access your Slack account. After you've done this, you can use the script in Shortcuts.
@atomicbird
atomicbird / wwdc2019-online-sessions.md
Last active May 29, 2020 22:59
WWDC 2019 Online-only Sessions

At WWDC 2019 Apple released some videos directly online, with no corresponding live session. This is a list of those videos with links to the video pages.

Some sessions were presented during WWDC but then split into multiple videos when posted online. This list includes the online versions, since they don't appear in the WWDC schedule. For example WWDC included session 711, "Introducing Combine and Advances in Foundation". This was split into two online videos-- 722, "Introducing Combine", and 723, "Advances in Foundation". Both 722 and 723 are included here.

@vookimedlo
vookimedlo / macos_mute_unmute.md
Last active May 10, 2024 18:16
MacOS: mute & unmute from command line

Mute volume

osascript -e "set volume with output muted"

Unmute volume

osascript -e "set volume without output muted"
@eni9889
eni9889 / pptweaks_electra.md
Last active February 9, 2024 05:50
Installing ++ Tweaks on Electra

WAIT FOR CYDIA