Skip to content

Instantly share code, notes, and snippets.

View TimonVS's full-sized avatar

Timon van Spronsen TimonVS

View GitHub Profile
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.
class Task {
status: "todo" | "done" = "todo";
completionDate?: Date;
isDone(): this is Task & { status: "done"; completionDate: Date } {
return this.status === "todo";
}
}
const task = new Task();
#!/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) {
@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');
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
https://wormhole.app/QW7RL#ncwHIJ2G0F3BZQm3DK8HMA
https://wormhole.app/kzZQ7#69VIM_fur0UFE9O0YjuZjw
https://wormhole.app/o4Qe9#btVAXg1nc7roXTsHmYv6tQ
schema:
- ${CONTENTFUL_BASE_URL}${CONTENTFUL_SPACE_ID}:
headers:
Authorization: Bearer ${CONTENTFUL_DELIVERY_ACCESS_TOKEN}
- schema.graphql # <--
documents: "./src/**/*.graphql"
generates:
./src/generated/graphql.ts:
plugins:
- typescript
import { fetchCapabilities } from "../actions"
mapDispatchToProps(dispatch) {
return {
fetchCapabilities: () => {
dispatch(fetchCapabilities())
}
}
}
@TimonVS
TimonVS / main.js
Created June 11, 2017 15:50
Electron workshop - step 3
const electron = require('electron')
// Module to control application life.
const app = electron.app
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow
const Menu = electron.Menu
const Tray = electron.Tray
const ipc = electron.ipcMain
const path = require('path')
@TimonVS
TimonVS / index.html
Last active June 11, 2017 13:44
Electron workshop - step 2
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Cryptocoin Tracker</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div id="app"></div>
</body>