Skip to content

Instantly share code, notes, and snippets.

@extratone
extratone / apps.md
Last active December 29, 2024 02:00
APPS
@sindresorhus
sindresorhus / esm-package.md
Last active April 21, 2025 02:29
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@extratone
extratone / embedas.md
Created February 16, 2021 23:30
Embed.as' Supported Platforms

See the original repo for the most up-to-date list.

Supported Providers

  • Airtable
  • Are.na
  • Bandcamp
  • Cinnamon
  • CloudApp
  • Codepen
import SwiftUI
@main
struct ExampleCommandsApp: App {
var body: some Scene {
DocumentGroup(
newDocument: ExampleCommandsDocument()
) { file in
ContentView(
@danielctull
danielctull / Really.swift
Last active June 1, 2022 08:58
I think I found the perfect improvement for force unwrapping in swift.
// EXAMPLE
let string: String? = "Hello World" // String?
let unwrappedString = string.really.srsly.itsfine.honestly.aaarggh // String
print(unwrappedString)
// IMPLEMENTATION
extension Optional {
@beefan
beefan / rem-widget-scriptable.js
Created November 26, 2020 04:37
REM Sleep Helper Widget
// SleepyTime
// when to set your alarm if you go to bed now
// wake up in between REM cycles to feel rested
//
const REM_CYCLE_LENGTH = 90
let widget = new ListWidget()
buildWidget()
// for debugging, allows script to run in app
@alldritt
alldritt / murderbot.js
Last active March 10, 2024 13:28
A script for Scriptable (https://apps.apple.com/us/app/scriptable/id1405459188) that creates a Midsummer Murders Bot (https://twitter.com/midsomerplots) iOS 14 Widget.
async function loadItems() {
let url = "https://midsomerplots.acrossthecloud.net/plot";
let req = new Request(url);
let json = await req.loadJSON();
return json;
}
function createWidget(plot) {
let w = new ListWidget()
@tallguyjenks
tallguyjenks / code.sh
Last active February 21, 2025 08:51
ZettelKasten Sync Code
# To permanently cache the credentials
git config --global credential.helper store
# To ignore files that could cause issues across different workspaces
touch .gitignore
echo ".obsidian/cache
.trash/
.DS_Store" > .gitignore
@mzeryck
mzeryck / mz_invisible_widget.js
Last active April 17, 2025 15:54
A Scriptable script that creates "invisible" widget backgrounds based on your iOS wallpaper, and then either uses them as a Scriptable widget background or exports to your camera roll.
/*
MIT License
Copyright (c) 2024 Maxwell Zeryck
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTW
@apiarian
apiarian / citibike-widget.js
Last active January 3, 2022 14:47
CitiBike Status iOS Widget
function lat_lon(thing) {
return {
"lat": thing.lat || thing.latitude,
"lon": thing.lon || thing.longitude,
}
}
function distance(loc1, loc2) {
loc1 = lat_lon(loc1)
loc2 = lat_lon(loc2)