Skip to content

Instantly share code, notes, and snippets.

@tera-ny
tera-ny / config.ts
Created October 23, 2021 08:31
google cloud transcoder api job config.
const request = {
parent: client.locationPath(projectID, regionID),
job: {
inputUri,
outputUri,
config: {
pubsubDestination: {
topic: pubsubTopicID,
},
elementaryStreams: [
@tera-ny
tera-ny / assertSnapshot.ts
Created April 13, 2022 05:13
Assertion function to perform SnapshotTest in Deno with update option
import {
assertEquals,
equal,
} from "https://deno.land/[email protected]/testing/asserts.ts";
import { copy } from "https://deno.land/[email protected]/fs/mod.ts";
export const assertSnapshot = async (
receivedPath: string,
expectedPath: string
) => {
@tera-ny
tera-ny / main.cjs
Created November 1, 2022 16:03
Storybook configuration file using vite
const { loadConfigFromFile, mergeConfig } = require("vite");
const path = require("path");
module.exports = {
...
async viteFinal(config) {
const result = await loadConfigFromFile(
{ command: "build", mode: "development" },
path.resolve(__dirname, "path to vite config")
);
@tera-ny
tera-ny / vscode.code-snippets
Created November 11, 2022 08:03
Snippets of function component
{
"Define FunctionComponents": {
"scope": "typescript,typescriptreact",
"prefix": "fc",
"body": [
"import { FC } from \"react\";",
"",
"const $TM_FILENAME_BASE: FC = () => <></>;",
"",
"export default $TM_FILENAME_BASE",
@tera-ny
tera-ny / Preload.tsx
Last active November 13, 2022 16:13
Component to preload images
import { FC, PropsWithChildren, ReactNode, useEffect, useState } from "react";
interface Props {
srcSets: { [key: string]: string };
fallback?: ReactNode;
}
const Preload: FC<PropsWithChildren<Props>> = ({
children,
fallback,