Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

蒲公英の生活 fewspider

Block or report user

Report or block fewspider

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fewspider
fewspider / test.js
Last active Apr 22, 2019
js 递归函数 获取json
View test.js
function fetchLast(obj, strs) {
// 1
// obj = a
// strs = ['b', 'c', 'd']
// 2
// obj = a['b']
// strs = ['c', 'd']
// 3
@fewspider
fewspider / format.js
Last active Dec 19, 2018
三目运算符避免不正确的数据
View format.js
var data = {
a: {
b: ''
},
d: '0',
dct: {
'0': 'aaaa',
'1': 'bbbb'
}
}
@fewspider
fewspider / request.js
Last active Dec 4, 2018
通用请求类
View request.js
import 'whatwg-fetch';
import queryString from 'query-string';
import { fetchMessage, fetchRootDomain } from './helper';
import { toast } from 'react-toastify';
export default class Request {
constructor(token) {
this.baseUrl = fetchRootDomain() + '/';
this.token = token;
}
@fewspider
fewspider / underscorejs-basic-usage.md
Last active Dec 4, 2018
underscorejs基本用法
View underscorejs-basic-usage.md

字典转数组

var dct = {
  a: 1,
  b: 2,
  c: 3
};

var list = _.map(_.pairs(dct), (item)=> {
  return {
View git-basic-usage.md

git clone git@github.com:fewspider/client-1.git 克隆一个项目到本地,默认路径是git项目的地址

git status 查看当前分支的状态

git add . 添加当前的修改

git commit -m 'update' 记录一个修改

git push origin master 提交当前所有修改到远程master分支

@fewspider
fewspider / isIntNumber.js
Last active Nov 4, 2015
javascript check int number
View isIntNumber.js
function isIntNumber(value) {
var numberRe = /^-?[0-9]+$/;
return typeof(value) === 'number' && numberRe.test(value);
}
@fewspider
fewspider / base10to26.py
Last active Sep 24, 2015
python converter 10 to 26
View base10to26.py
# -*- coding: utf-8 -*-
'''
copyright: (c) 2015 by fewspider(fewspider@gmail.com).
~~~~~~~~~
converter 10 to 26,like:
1 -> A
2 -> B
27 -> AA
~~~~~~~~~
test it:
You can’t perform that action at this time.