Skip to content

Instantly share code, notes, and snippets.

@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
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 6, 2024 07:22
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@ahawker
ahawker / battery.cs
Last active February 16, 2024 06:36
Battery info from win32 api
using System;
using System.IO;
using Microsoft.Win32.SafeHandles;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Text;
namespace Test
{