Skip to content

Instantly share code, notes, and snippets.

View mastermakrela's full-sized avatar

Christoph mastermakrela

View GitHub Profile
@mastermakrela
mastermakrela / settings.json
Created October 11, 2024 18:54
VS Code settings to use Deno's TypeScript instead of the default one
{
"deno.enable": true,
"deno.lint": true,
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"typescript.tsserver.experimental.enableProjectDiagnostics": false
}
@mastermakrela
mastermakrela / file_handlers.ts
Last active October 18, 2024 14:43
File selector for js/ts
export async function open_file({ accept }: { accept?: string }): Promise<File> {
const input = document.createElement('input');
input.type = 'file';
if (accept) input.accept = accept;
input.click();
return new Promise((resolve, reject) => {
input.onchange = () => {
const file_handle = input.files?.[0];