This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-useless-escape */ | |
// uno.config.ts | |
import { defineConfig } from 'unocss' | |
function spaceToRem(space: string) { | |
const num = parseInt(space) | |
if (!isNaN(num)) { | |
return `${num * 0.25}rem` | |
} | |
return space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect } from "react" | |
function useDebounceEffect(effect: () => void, deps: unknown[], delay: number) { | |
useEffect(() => { | |
const timeout = setTimeout(() => { | |
effect() | |
}, delay) | |
return () => { | |
clearTimeout(timeout) | |
} | |
}, [...(deps || []), delay]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from "react" | |
import { BehaviorSubject, Observable, filter, shareReplay } from "rxjs" | |
export function createSignal<T>(initialValue?: T) { | |
const v$ = new BehaviorSubject<T | undefined>(initialValue) | |
const setValue = (v: T) => { | |
v$.next(v) | |
} | |
return [v$, setValue] as [BehaviorSubject<T>, (v: T) => void] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
clearMocks: true, | |
reporters: [ | |
"default", | |
["jest-junit", { outputDirectory: "coverage", outputName: "report.xml" }], | |
["jest-silent-reporter", { useDots: true }], | |
], | |
coverageReporters: ["clover", "json", ["lcov", {}], ["text", { skipFull: true }]], | |
collectCoverageFrom: ["src", "!**/*.d.ts", "!**/node_modules/**"], | |
moduleNameMapper: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@use 'sass:math' | |
$dd-width: 375px | |
$ratio: math.div(1, 10) | |
@function strip-unit($number) | |
@if type-of($number) == 'number' and not unitless($number) | |
@return math.div($number, ($number * 0 + 1)) | |
@return $number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
import path from 'path' | |
import yargs from 'yargs/yargs' | |
import fs from 'fs/promises' | |
import figlet from 'figlet' | |
import chalk from 'chalk' | |
import init from './command-init' | |
import packageJSON from '../package.json' | |
import { setLevel, Level } from 'utils/logger' | |
import { GlobalOptions } from 'command-init/types' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Covert Goland env to .env format | |
* e.g. | |
* Let's say we have env `ENV=production` and `DB=some-db-url` configured in Golang. It will be the following format when it is copiled from the conf. | |
* ENV=production;DB=some-db-url | |
* But the popular env format `.env` use the following format: | |
* ENV=production | |
* DB=some-db-url | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: tekton.dev/v1beta1 | |
kind: Task | |
metadata: | |
name: deploy-web-to-s3 | |
namespace: default | |
spec: | |
params: | |
- name: build_command | |
type: string | |
default: npm build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useCallback } from 'react' | |
import { render } from 'react-dom' | |
function Others() { | |
return <div>other will be rendered inside shadow tree</div> | |
} | |
class RendereComponent extends HTMLElement { | |
connectedCallback() { | |
const shadowRoot = this.attachShadow({ mode: 'open' }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
categories: | |
- category: tech | |
feeds: | |
- http://rachelbythebay.com/w/atom.xml | |
- http://feeds.feedburner.com/ruanyifeng | |
- http://blog.samaltman.com/posts.atom | |
- https://dave.cheney.net/feed/atom |
NewerOlder