Skip to content

Instantly share code, notes, and snippets.

View agileago's full-sized avatar

backpast agileago

View GitHub Profile
@agileago
agileago / vite.config.ts.md
Created January 6, 2024 09:21 — forked from jasenmichael/vite.config.ts.md
Folder as entry in library mode for multiple independent js modules
./src/
  src/cli.ts
  src/index.ts
./vite.config.ts

vite.config.ts

import { resolve } from "node:path"
@agileago
agileago / .npmrc
Created February 22, 2023 03:51 — forked from blackcater/.npmrc
.npmrc configuration
# global config
# init config
init-author-name = blackcater
init-author-email = i@blackcater.dev
init-author-url = https://blackcater.com
# git tag message
message = "chore: version bump to v%s"
@agileago
agileago / vue3-oop.tsx
Last active June 14, 2022 07:31
vue3-oop示例
import {
Autobind,
Component,
ComponentProps,
Computed,
Hook,
Mut,
VueComponent,
VueService,
} from 'vue3-oop'
@agileago
agileago / retry.ts
Created May 12, 2022 13:55
超时重试
interface ResponseData {
code: -1 | 0 | 1
msg: string
data: any
}
function getData(timeout: number) {
return Promise.race([
new Promise<ResponseData>((resolve, reject) => {
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@agileago
agileago / ts-type-guide.md
Created March 15, 2021 01:11 — forked from pissang/ts-type-guide.md
TypeScript 类型编写指南

TypeScript 类型编写指南

前言

本文主要作为平时在 TypeScript 代码中编写类型以及对 TypeScript 代码进行 review 时候的参考手册,并非强制执行的规范,也不涉及纯代码风格以及代码逻辑上的指导。

前置阅读

本文内容参考了下面几个手册,所以强烈建议能够同时阅读完这几个手册。如果大家对 TypeScript 的一些基础用法和特性还不熟悉,也建议先阅读第一个 TypeScript 手册。

@agileago
agileago / app.vue
Created September 11, 2019 03:54
路由控制以及css
<template>
<div class="cpq-ui">
<transition :name="'cpq-router-' + routerDirection" :css="!!routerDirection">
<router-view class="cpq-router-view"></router-view>
</transition>
</div>
</template>
<script>
import router from './router'
@agileago
agileago / historyTransition.js
Created December 4, 2018 13:33
移动端路由切换动画处理
export default function historyManage (store, router) {
store.registerModule('transition', {
state: {
direction: ''
},
mutations: {
UPDATE_DIRECTION (state, direction) {
state.direction = direction
}
}
@agileago
agileago / vue.config.js
Created November 20, 2018 09:45
vue config
const path = require('path')
function resolve(dir) {
return path.join(__dirname, '.', dir)
}
module.exports = {
baseUrl: './',
productionSourceMap: false,
chainWebpack: config => {
@agileago
agileago / helper.js
Last active August 29, 2018 07:19
一些常用函数
/**
* 过滤掉不受支持的emoji表情
* @param str
* @returns {*}
*/
export function replaceUndisplayEmoji (str) {
if (!str) return str
return str.replace(/[\ue000-\ue537]/g, '')
}