This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 中秋博饼 | |
* MidAutumn::random(); | |
*/ | |
class MidAutumn { | |
public static function random () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="zh-CN"> | |
<head> | |
<!--author:Vace_Vlm([email protected]),create:15 Jan 2021 11:17 AM--> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | |
<meta name="renderer" content="webkit"> | |
<meta http-equiv="Cache-Control" content="no-siteapp" /> | |
<meta name="apple-mobile-web-app-title" content="vace" /> | |
<meta name="format-detection" content="telephone=no" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const path = require('path') | |
const http = require('http') | |
const https = require('https') | |
const Stream = require('stream').Transform | |
// @example | |
// const list = require('./downloadurls.json') | |
// downloadList(list, { onItem: res => console.log('✅:', res.basename) }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function slice_utf8str(str, maxLen) { | |
var len = str.length | |
var _len = 0 | |
var i = 0 | |
for (; i < len; i++) { | |
_len += str.charCodeAt(i) < 256 ? 1 : 2 | |
if (_len > maxLen) break | |
} | |
return str.slice(0, i) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 支持:135,96,365,小蚂蚁编辑器 | |
*/ | |
;(function () { | |
var host = location.host | |
var isDomain = function (t) { | |
return host.indexOf(t) !== -1 | |
} | |
var showOk = function (t) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* [csvTextParser 简单的csv文本解析器] | |
* @param {string} text [csv文本] | |
* @param {boolean} columns [读取第一行做为表头] | |
* @param {array} columns [列配置] | |
* @param {string} columns[i].field 字段名 | |
* @param {int} columns[i].index? 对应列索引,默认为i | |
* @param {int} columns[i].trim? 是否首尾去空 | |
* @param {string|Function} columns[i].type 字段类型(int,float,string,boolean,function) | |
* @param {object} options [解析配置] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debounce(func, wait, immediate){ | |
var timeout, args, context, timestamp, result; | |
if (null == wait) wait = 100; | |
function later() { | |
var last = Date.now() - timestamp; | |
if (last < wait && last >= 0) { | |
timeout = setTimeout(later, wait - last); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* from : https://github.com/Clarence-pan/unpack-wxapkg */ | |
function unpack_wxapkg($file, $targetDir) | |
{ | |
if (!is_dir($targetDir)){ | |
mkdir($targetDir); | |
} | |
echo "Reading file.\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* csv data encode | |
* var data = [[1850, 20, 0, 1, 1017281], [1850, 20, 0, 2, 1003841]]; | |
* encode(data) | |
* encode(data,{ header: ["year", "age", "status", "sex", "population"] }) | |
* encode([{age:xx,name:'xxx'}], {header:true}) | |
* options:{ delimiter:'分隔符',newline:换行符,skip:头部跳过数量,header:Object或者arrat } | |
*/ | |
const CELL_DELIMITERS = [',', ';', '\t', '|', '^'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const REPLACE_REGEX = /(Y|M|D|H|I|S|T)/ig | |
export function timeFormat(unixTime, format = 'Y-M-D H:i:s') { | |
var time = new Date(unixTime * 1000) | |
var conf = { | |
Y: time.getFullYear(), | |
M: pad(time.getMonth() + 1), //月份 | |
D: pad(time.getDate()), //日 | |
H: pad(time.getHours()), //小时 | |
I: pad(time.getMinutes()), //分 | |
S: pad(time.getSeconds()), //秒 |
NewerOlder