- Create repo on GitHub where you'll put your files.
- Use jsDeliver or statically to get your assets.
Here is repo I'm using:
https://github.com/jcubic/static
And links to files look like this:
| /*jslint beta, node*/ | |
| // This gist file demos a performant, self-contained function "globExclude()", | |
| // which batch-globs <pathnameList> in a single pass, | |
| // with given filters <excludeList>, <includeList>. | |
| // | |
| // Could be useful if you need to glob thousands of files for test-coverage, | |
| // or other purposes. | |
| // Example usage |
| #!/usr/bin/osascript -l JavaScript | |
| 'use strict'; | |
| const DEBUG = false; | |
| function launchTerminal(path) { | |
| const terminalApp = Application("Terminal.app") | |
| terminalApp.includeStandardAdditions = true | |
| let cmd = `cd ${path}; clear;` |
| url scheme: | |
| x-apple.systempreferences:com.apple.KEY[.KEY]?SUB-PANE | |
| examples: | |
| x-apple.systempreferences:com.apple.systempreferences.AppleIDSettings?iCloud | |
| x-apple.systempreferences:com.apple.preference.keyboard?Shortcuts | |
| urls: | |
| com.apple.systempreferences.ApplelDSettings |
| #!/bin/sh | |
| # ks_changeset v0.9 - 2022-05-03 | |
| # Enable "safe" mode - see http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
| set -euo pipefail | |
| IFS=$'\n\t' | |
| if [[ $# -lt 3 ]]; then | |
| echo "Usage: ks_changeset.sh <FolderA> <FolderB> <DestinationGit>" |
Here is repo I'm using:
https://github.com/jcubic/static
And links to files look like this:
| # Manual opt parsing example | |
| # | |
| # Features: | |
| # - supports short and long flags (ie: -v|--verbose) | |
| # - supports short and long key/value options (ie: -f <file> | --filename <file>) | |
| # - supports short and long key/value options with equals assignment (ie: -f=<file> | --filename=<file>) | |
| # - does NOT support short option chaining (ie: -vh) | |
| # - everything after -- is positional even if it looks like an option (ie: -f) | |
| # - once we hit an arg that isn't an option flag, everything after that is considered positional | |
| function optparsing_demo() { |
| getJsonValue() { | |
| # $1: JSON string to process, $2: Desired JSON key | |
| osascript -l 'JavaScript' -e "JSON.parse(\`$1\`).$2;" | |
| } | |
| # String sent by a rogue API endpoint | |
| json='{}`);const app = Application.currentApplication(); app.includeStandardAdditions = true;app.displayAlert("👾🔥🙈");JSON.parse(`{}'; | |
| fullName=$(getJsonValue "$json" name) |
First, make a new file with the following contents:
#!/usr/bin/env ruby
dirs = []
ARGF.each { |line| dirs.push(line) }| import Cocoa | |
| import MediaPlayer | |
| let bundle = CFBundleCreate(kCFAllocatorDefault, NSURL(fileURLWithPath: "/System/Library/PrivateFrameworks/MediaRemote.framework")) | |
| let MRMediaRemoteRegisterForNowPlayingNotificationsPointer = CFBundleGetFunctionPointerForName( | |
| bundle, "MRMediaRemoteRegisterForNowPlayingNotifications" as CFString | |
| ) | |
| typealias MRMediaRemoteRegisterForNowPlayingNotificationsFunction = @convention(c) (DispatchQueue) -> Void | |
| let MRMediaRemoteRegisterForNowPlayingNotifications = unsafeBitCast(MRMediaRemoteRegisterForNowPlayingNotificationsPointer, to: MRMediaRemoteRegisterForNowPlayingNotificationsFunction.self) |
The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.
This means you have the following choices:
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.await import(…) from CommonJS instead of require(…).