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
const createStore = importModule('store'); | |
const { describe } = importModule('test'); | |
const store = createStore('store-test'); | |
await describe('Store', async test => { | |
const key = 'key'; | |
const value = 'value'; | |
await test('Saves and retrieves a value', async () => { | |
store.set(key, value); |
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
module.exports = storeName => { | |
const files = FileManager.iCloud(); | |
const documents = files.documentsDirectory(); | |
const stores = `${documents}/stores`; | |
const store = `${stores}/${storeName}`; | |
if (!files.isDirectory(stores)) { | |
files.createDirectory(stores); | |
} |
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
exports.describe = async (name, callback) => { | |
const output = []; | |
const test = async (name, callback) => { | |
const testStartTime = Date.now(); | |
const testResult = await callback(); | |
const testTime = | |
Date.now() - testStartTime; | |
output.push( | |
`• ${name} (${testTime}ms): ${ | |
testResult ? '✅' : '❌' |
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: green; icon-glyph: file-code; | |
const getModule = importModule("getModule"); | |
const documentDirectory = FileManager.iCloud().documentsDirectory(); | |
module.exports = async ({ moduleName, url, forceDownload = false }) => { | |
if (moduleExists(moduleName) && !forceDownload) { | |
return importModule(moduleName); |
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: green; icon-glyph: file-code; | |
module.exports = async ({ url, headers = {} }) => { | |
const request = new Request(url); | |
request.method = methods.get; | |
request.headers = { | |
...headers | |
}; | |
return await request.loadString(); |
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: green; icon-glyph: file-code; | |
const getString = importModule('getString'); | |
const documentDirectory = FileManager.iCloud().documentsDirectory(); | |
const header = `// Variables used by Scriptable. | |
// These must be at the very top of the file. Do not edit. | |
// icon-color: deep-gray; icon-glyph: file-code;`; |
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: green; icon-glyph: file-code; | |
module.exports = { | |
post: async ({ url, body, headers = {} }) => { | |
const request = new Request(url); | |
request.body = JSON.stringify(body); | |
request.method = methods.post; | |
request.headers = { | |
...defaultHeaders, |
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
function Load { | |
param([scriptblock]$function, | |
[string]$Label) | |
$job = Start-Job -ScriptBlock $function | |
$symbols = @("⣾⣿", "⣽⣿", "⣻⣿", "⢿⣿", "⡿⣿", "⣟⣿", "⣯⣿", "⣷⣿", | |
"⣿⣾", "⣿⣽", "⣿⣻", "⣿⢿", "⣿⡿", "⣿⣟", "⣿⣯", "⣿⣷") | |
$i = 0; | |
while ($job.State -eq "Running") { | |
$symbol = $symbols[$i] |
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
function Elevate { | |
Param ($Path) | |
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator') ` | |
-And [int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) | |
{ | |
$CommandLine = "-File `"$Path`"" | |
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine | |
Exit | |
} | |
} |
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
@echo off | |
:: BatchGotAdmin | |
:------------------------------------- | |
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" | |
if '%errorlevel%' NEQ '0' ( | |
echo Requesting administrative privileges... | |
goto UACPrompt | |
) else ( goto gotAdmin ) | |
:UACPrompt | |
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" |
NewerOlder