Skip to content

Instantly share code, notes, and snippets.

View simple-single-spa-how-to-use.js
import { registerApplication, start, navigateToUrl } from 'single-spa';
import { h, render, Fragment } from 'preact';
// navigateToUrl を発行するだけの x-link 要素
customElements.define("x-link", class extends HTMLElement {
connectedCallback() {
this.style.textDecoration = "underline";
this.style.color = "blue";
this.addEventListener("click", (ev) => {
ev.preventDefault();
View tf.es.js
This file has been truncated, but you can view the full file.
/* prebuilt es */
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
View tf-core.es.js
This file has been truncated, but you can view the full file.
/* build tfjs-core for esm */
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
View index.vue
<template>
<div>
<Sub message="hello" />
</div>
</template>
<script lang="ts">
import {
defineComponent,
reactive,
View add-expect-error.ts
import * as ts from "typescript";
import { uniq } from "lodash";
import fs from "fs";
import path from "path";
function compile(fileNames: string[], options: ts.CompilerOptions): void {
let program = ts.createProgram(fileNames, options);
let emitResult = program.emit();
let allDiagnostics = ts
View try-typegoose.ts
import dotenv from "dotenv";
import mongoose from "mongoose";
import { prop, getModelForClass } from "@typegoose/typegoose";
dotenv.config();
class Task {
@prop({ required: true })
name!: string;
View minitest.ts
const testFns: Array<{ name: string; fn: Function }> = [];
const beforeEachs: Function[] = [];
const afterEachs: Function[] = [];
export function clear() {
testFns.length = 0;
beforeEachs.length = 0;
afterEachs.length = 0;
}
@mizchi
mizchi / tsconfig.json
Created Jun 12, 2020
emitDeclarationOnly
View tsconfig.json
{
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"target": "es5",
"module": "esnext",
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
View minibundle.ts
// small bundler
import path from "path";
import { parse } from "@babel/parser";
import traverse from "@babel/traverse";
import generate from "@babel/generator";
import * as t from "@babel/types";
import type { IPromisesAPI } from "memfs/lib/promises";
View deflate-native-and-inflate-by-pako.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/1.0.11/pako.js"></script>
<script type="module">
You can’t perform that action at this time.