<button>Let's Go !</button>
This file contains 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
// http://douyu.shiniv.com/ | |
// 自动打开有宝箱的直播间, 30秒后自动关闭 | |
(function () { | |
let windowOpenedCount = 0 | |
let timer = setInterval(() => { | |
let blockEls = document.querySelector('#message').children | |
let len = blockEls.length | |
for (; len--;) { | |
let elm = blockEls[len] | |
let timerElm = elm.querySelector('blockquote .timeleft'); |
This file contains 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 path = require('path') | |
const chokidar = require('chokidar') | |
const resolve = dir => path.resolve(__dirname, '..', '..', dir) | |
const includes = require('array-includes') | |
const generateRoutes = require(resolve('scripts/generateRoutes')) | |
const routeFile = resolve('src/routes/index.js') | |
function Plugin() { | |
this._init = false | |
} |
This file contains 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-extra') | |
const path = require('path') | |
const resolve = dir => path.resolve(__dirname, '..', 'src', dir) | |
const viewsDir = resolve('views') | |
const routeFile = resolve('routes/index.js') | |
// 移除JSON字符串中component的引号 | |
const excludeQuote = str => str.replace(/(\s*component":\s*)"([^""]+)"(.*)/g, '$1$2$3') | |
// 将对象字面量转为导出格式的JSON字符串 | |
const exportString = obj => `export default ${excludeQuote(JSON.stringify(obj, '', 2))}` |
This file contains 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
// Based on Glacier's example: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/examples.html#Amazon_Glacier__Multi-part_Upload | |
var fs = require('fs'); | |
var AWS = require('aws-sdk'); | |
AWS.config.loadFromPath('./aws-config.json'); | |
var s3 = new AWS.S3(); | |
// File | |
var fileName = '5.pdf'; | |
var filePath = './' + fileName; | |
var fileKey = fileName; |
This file contains 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
var http = require('http'); | |
/** | |
* 读取远程文件 | |
* | |
* @param {String} url | |
* @param {Function} cb | |
* - {Error} err | |
* - {Buffer} buf | |
*/ |
This file contains 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 getDateDiff(dateTimeStamp){ | |
var minute = 1000 * 60; | |
var hour = minute * 60; | |
var day = hour * 24; | |
var halfamonth = day * 15; | |
var month = day * 30; | |
var now = new Date().getTime(); | |
var diffValue = now - dateTimeStamp; | |
var monthC =diffValue/month; | |
var weekC =diffValue/(7*day); |