Skip to content

Instantly share code, notes, and snippets.

View wisetc's full-sized avatar
😉
missing

Ben wisetc

😉
missing
  • 中国·杭州
View GitHub Profile
@wisetc
wisetc / picker-field.js
Last active August 4, 2018 08:15
DeepMap函数,深拷贝映射生成新的对象,用于接口和组件的选项对应。
{
loadItemOptions: function() {
var url = 'http://' + hostname + ':21275/data/repair_category/all';
var _this = this;
fetch(url, {
method: 'POST'
})
.then(function(res) {
return res.json();
})
@wisetc
wisetc / tmux-cheatsheet.markdown
Created May 29, 2018 02:59 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@wisetc
wisetc / requires-auth.js
Created May 7, 2018 03:26
检查页面登陆状态,如果缓存中没有登陆信息则跳转到登陆页面。
define(['./user-info', './is-weixin'], function (userInfo, isWeichat) {
function goToAuth() {
window.location.href = './login.html?redirect=' + getRedirect();
}
function getRedirect() {
var pattern = /https?:\/\/.+\/(\w+\.html)/;
var redirectUri = pattern.exec(location.href)[1];
// 某些页面需要从上一个页面进入,否则会加载不到缓存中的数据。-- 设计失败。
@wisetc
wisetc / jquery-loading.js
Created April 26, 2018 06:43
Loading using jQuery.
define(function () {
function init() {
var html = `<div class="u-mask" style="background-color: rgba(0, 0, 0, 0.8);">
<div class="u-spinner">
<i class="u-icon-loading"></i>
<p class="u-loading-text">正在拼命发起请求</p>
</div>
</div>`
$('body').append(html);
@wisetc
wisetc / cloudSettings
Created April 24, 2018 12:44
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-04-24T12:44:34.532Z","extensionVersion":"v2.9.0"}
@wisetc
wisetc / report.js
Last active August 9, 2019 10:04
增删改查报告结果
import { Message } from 'element-ui'
function noop {}
export default function report (data, type='', callback=noop) {
let map = {
create: '新增',
update: '修改',
destroy: '删除'
}
@wisetc
wisetc / Area.vue
Last active March 5, 2018 01:22
区域管理,树状图
<template>
<div>
<el-button type="primary" size="mini" @click="handleClick0">添加同级</el-button>
<el-button type="primary" size="mini" @click="handleClick1">添加下级</el-button>
<el-button type="warning" size="mini" @click="handleClick2">修改</el-button>
<el-button type="danger" size="mini" @click="handleClick3">删除</el-button>
<el-tree
ref="tree"
:data="data"
@wisetc
wisetc / showTables.js
Created January 30, 2018 09:24
Simple http service to show tables of specified database.
require('dotenv').config({ path: './.env' })
var express = require('express');
var router = express.Router();
const mysql = require('mysql2/promise');
const co = require('co');
const chalk = require('chalk');
/* GET users listing. */
router.get('/:database/tables', function (req, res, next) {
process.env.DB_DATABASE = req.params.database;
@wisetc
wisetc / crud.loadData.mixin.vue
Created January 30, 2018 02:11
LoadData composition of searcher for xtits
import { Simple } from 'vue-element-crud'
import Pagination from './Pagination'
export default {
mixins: [Simple, Pagination],
data() {
return {
api: {},
loading: false
@wisetc
wisetc / laravellocal.md
Last active January 10, 2018 01:04 — forked from hootlex/laravellocal.md
Run laravel project locally

Windows users:

cmder will be refered as console

Mac Os, Ubuntu and windows users continue here:

  • Create a database locally named homestead utf8_general_ci