Skip to content

Instantly share code, notes, and snippets.

View TimonVS's full-sized avatar

Timon van Spronsen TimonVS

View GitHub Profile
@TimonVS
TimonVS / 2.js
Last active January 13, 2022 09:43
Download input values to a txt file
const textInputElements = document.querySelectorAll('input[type="text"]');
const inputValues = nodeListToArray(textInputElements)
.filter((x) => !!x.value)
.map((x) => [getFirstLabelForInput(x), x.value].join(' '));
const text = inputValues.join('\n');
const blob = new Blob([text], {
type: 'text/plain',
});
downloadBlob(blob, 'text.txt');
#!/usr/bin/env zx
// Title: Replace Semantic Release config with shared config
import 'zx/globals';
const semanticReleaseConfigPath = './.releaserc.js';
const hasSemanticReleaseConfig = await fs.pathExists(semanticReleaseConfigPath);
if (hasSemanticReleaseConfig) {
class Task {
status: "todo" | "done" = "todo";
completionDate?: Date;
isDone(): this is Task & { status: "done"; completionDate: Date } {
return this.status === "todo";
}
}
const task = new Task();
openapi: 3.0.0
info:
title: Sample API
version: 1.0.0
servers:
- url: http://api.example.com/v1
paths:
/users:
get:
summary: Returns a list of users.