Skip to content

Instantly share code, notes, and snippets.

View wisetc's full-sized avatar
😉
missing

Ben wisetc

😉
missing
  • 中国·杭州
View GitHub Profile
@wisetc
wisetc / xhr._utils.js
Created August 31, 2019 01:31
Make axios instance.
import { Toast } from 'saltui';
import Axios from 'axios';
import env from 'src/env';
export const requestHeaders = { 'Content-Type': 'application/json' };
export const transformRequest = (data = {}, headers) => {
if (typeof data === 'string') return data;
return JSON.stringify(data);
@wisetc
wisetc / guide.md
Created March 22, 2021 06:32 — forked from GavinRay97/guide.md
Configuring Nuxt for Composition API and TSX Support

Main

Use create-nuxt-app and enable the Typescript related options to scaffold a new boilerplate TS Nuxt repo:

yarn create nuxt-app <my-project>
# or
npx create-nuxt-app <my-project>
@wisetc
wisetc / macOS-in-virtualbox.md
Created December 26, 2020 01:47 — forked from rob-smallshire/macOS-in-virtualbox.md
Notes on getting macOS Sierra running in Virtualbox on a Windows 10 host

On Mac

Download, but don't run, the Sierra installer from the Mac App Store. This places the installer at /Applications/Install\ macOS\ Sierra.app/.

Now run the following commands to build a suitable VM image from the installer:

git clone https://github.com/jonanh/osx-vm-templates
cd osx-vm-templates/packer

sudo ../prepare_iso/prepare_vdi.sh -D DISABLE_REMOTE_MANAGEMENT -o macOS_10.12.vdi /Applications/Install\ macOS\ Sierra.app/ .

@wisetc
wisetc / InputNumber.vue
Last active November 22, 2020 16:11
Vue component number input to replace el-input-number of element-ui.
<script>
import emitter from 'element-ui/src/mixins/emitter';
export default {
mixins: [emitter],
props: {
value: Number,
max: { type: Number, default: 99999 },
min: { type: Number, default: 0 },
int: { type: Boolean, default: false },
@wisetc
wisetc / postinstall.js
Created October 25, 2020 07:07
npm link local modules nodejs scripts.
const assert = require('assert');
const {promisify} = require('util');
const fs = require('fs');
const {resolve} = require('path');
//
const symlink = promisify(fs.symlink);
const stat = promisify(fs.stat);
const mkdir = promisify(fs.mkdir);
@wisetc
wisetc / install-tmux.sh
Created July 14, 2020 07:00 — forked from pokev25/install-tmux.sh
Install tmux 2.8 on centos 7
# Install tmux 2.8 on Centos
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -LOk https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar -xf libevent-2.1.8-stable.tar.gz
cd libevent-2.1.8-stable
./configure --prefix=/usr/local
@wisetc
wisetc / example.vue
Last active May 18, 2020 08:09
vue searcher based on element-ui.
<template>
<div>
<m-searcher :kw="kw" :fields="searchFields" :placeholders="placeholders" @search="loadData">
<el-select v-model="kw.moldsId" clearable size="small" @clear="loadData" class="search-box__input">
<el-option :key="index" v-for="(o, index) in molds"
:label="o.code" :value="o.id"/>
</el-select>
</m-searcher>
</div>
</template>
@wisetc
wisetc / field-collection.vue
Created January 8, 2020 06:47
不定项录入表单
<template>
<div class="field-collection">
<el-form class="_item" v-for="(form, i) in C" :key="i" inline label-width="120px">
<el-form-item class="_item__col" :label="type + '编号'">
<el-input type="text" class="_input-el" v-model="form.number" @change="emitForm" />
</el-form-item>
<el-form-item class="_item__col" :label="priceLabel">
<el-input type="number" class="_input-el" v-model.number="form.price" @change="emitForm" />
<span class="_price-unit">{{ priceUnit }}</span>
</el-form-item>
@wisetc
wisetc / field-collection.vue
Created December 6, 2019 07:00
表单列表类
<template>
<div class="field-collection">
<el-form class="_item" v-for="(form, i) in C" :key="i" inline label-width="120px">
<el-form-item class="_item__col" :label="type + '编号'">
<el-input type="text" class="_input-el" v-model="form.number" @change="emitForm" />
</el-form-item>
<el-form-item class="_item__col" :label="priceLabel">
<el-input type="number" class="_input-el" v-model.number="form.price" @change="emitForm" />
<span class="_price-unit">{{priceUnit}}</span>
</el-form-item>
@wisetc
wisetc / ContractForm.jsx
Created September 17, 2019 06:16
Complex interaction with ajax. 纠结的判断。
import React, { Component, Fragment } from 'react';
import { Dialog } from 'saltui';
import { observer } from 'mobx-react';
import { toJS } from 'mobx';
import {
Viewport,
InputField,
DataList,
NoContext,
PickerField,