Skip to content

Instantly share code, notes, and snippets.

View buxuku's full-sized avatar

Lin Xiaodong buxuku

View GitHub Profile
@buxuku
buxuku / gist:3f81274b88bc14965535306adfa97212
Created June 11, 2024 07:35
vercel multiple environment variables
- DEPLOYMENT_URL=$(vercel deploy --prod $(grep -v '^#' .env.production | sed 's/^/--build-env /' | tr '\n' ' '))
@buxuku
buxuku / customRequest.js
Created June 11, 2020 12:33
antd upload自定义上传实现
/* eslint no-console:0 */
import React from 'react';
import ReactDOM from 'react-dom';
import Upload from 'rc-upload';
import axios from 'axios';
const uploadProps = {
action: '/upload.do',
multiple: false,
data: { a: 1, b: 2 },
@buxuku
buxuku / get.js
Created May 9, 2020 14:43
[取值风险] js中get取值的风险
const obj={
a: 1,
get then(){
if(this.a == 1){
this.a++;
return function (){}
}else{
throw new Error('error')
}
}
@buxuku
buxuku / promisify.js
Created May 7, 2020 16:02
[promisify] 异步函数promise化 #javascript #promise
const fs = require("fs");
function promisify(fn) {
return function (...arg) {
return new Promise((resolve, reject) => {
fn(...arg, function (err, data) {
if (err) reject(err);
resolve(data);
});
});
};
@buxuku
buxuku / 1.js
Last active May 7, 2020 07:54
curry
let _ = {};
function curry(fn, args) {
var length = fn.length;
args = args || [];
return function () {
var _args = args.slice(0),
arg,
i;
_args.forEach((item, index, arr) => {
if (item == _ && arguments.length > 0) {
@buxuku
buxuku / fn.js
Last active May 7, 2020 05:56
new fn
function Fn{}
const fn = new Fn()