Skip to content

Instantly share code, notes, and snippets.

View dohooo's full-sized avatar

Caspian Zhao dohooo

View GitHub Profile
dohooo / gitlab-ci-exit-process.yml
Last active December 28, 2022 06:41
Exit process when the target branch not matching in gitlab CI
View gitlab-ci-exit-process.yml
stage: verify
- exit 1
dohooo / download-tarball.js
Created December 28, 2022 06:40
Using `download` library download the tarball file.
View download-tarball.js
download(TAR_URL, FILE_NAME, {
headers: {
Authorization: `Basic ${Buffer.from(`${USERNAME}:${PAT}`).toString('base64')}`,
}).then((r) => {
dohooo / config.js
Created August 5, 2022 16:23
How to use jiti.js.
View config.js
export default {
dohooo / setup.ts
Last active December 28, 2022 06:46
How to test file via visual testing.
View setup.ts
import "@testing-library/jest-dom";
import { setProjectAnnotations } from "@storybook/react";
import "jest-styled-components";
import { decorators } from "../../.storybook/withEditor";
setProjectAnnotations({ decorators });
dohooo / snapshot.test.tsx
Last active December 29, 2022 04:09
Visual testing with vitest
View snapshot.test.tsx
import { join } from "path";
import type { Meta, StoryFn } from "@storybook/react";
import { composeStories } from "@storybook/react";
import { render } from "@testing-library/react";
import glob from "glob";
import { toMatchImageSnapshot } from "jest-image-snapshot";
import { chromium, type Browser, type Page } from "playwright";
import { afterAll, beforeAll, expect, describe, it, vi } from "vitest";
dohooo / gist:fc3789310802b1f4b66e8b110ad2ce78
Last active January 6, 2023 08:49
Development with docker.
We couldn’t find that file to show.
dohooo /
Last active April 5, 2023 10:01
Open temp file.
# This opentemp function is designed to help developers quickly create and switch to a new temporary branch for debugging and development purposes, without interfering with the existing files or branches. It automates the process of navigating to the ~/code/temp/ directory, checking for uncommitted changes, committing them if necessary, and creating a new branch with a user-defined or timestamp-based name.
# Here's a brief overview of how to use the opentemp function:
# Add the opentemp function to your ~/.zshrc file and save it. This ensures that the function is loaded every time you start a new terminal session.
# Run source ~/.zshrc to apply the new configuration immediately without restarting the terminal.
# To create a new temporary branch for debugging or development, simply run the opentemp command followed by an optional task name. For example:
# opentemp (without a task name) will create a new branch with a timestamp-based name, such as "temp-debug-20230405-143000".
# opentemp my-feature (with a ta
View skia-shader
import { useEffect, type FC } from "react";
import { Button, Dimensions, ScrollView, Text, View } from "react-native";
import type { SharedValue } from "react-native-reanimated";
import { Easing, Extrapolate, interpolate, useDerivedValue, useSharedValue, withDecay, withDelay, withRepeat, withTiming } from "react-native-reanimated";
import { SafeAreaView } from "react-native-safe-area-context";
import { Blur, Canvas, DisplacementMap, Fill, FractalNoise, Group, LinearGradient, Rect, RoundedRect, Shadow, Turbulence, Vertices, vec } from "@shopify/react-native-skia";
const { width } = Dimensions.get("window");
View Images Dimension Testing.
const images = [