Skip to content

Instantly share code, notes, and snippets.

View Dafrok's full-sized avatar
🏳️‍🌈
正在变基

Dafrok Dafrok

🏳️‍🌈
正在变基
View GitHub Profile
~function () {
var flag = true
var interval
function refresh() {
if (flag) {
console.log((new Date).toLocaleString())
var iframe = document.createElement('iframe')
iframe.src = 'https://shop103422196.taobao.com/category.htm?spm=a1z10.3-c.w4002-6402908702.30.83cQDQ&_ksTS=1465271481288_143&callback=jsonp144&mid=w-6402908702-0&wid=6402908702&path=%2Fcategory.htm&orderType=newOn_desc'
document.body.appendChild(iframe)
iframe.onload = function () {
const defaultManagerUrl = 'https://openapi.iqiyi.com';
const defaultUploadUrl = 'https://upload.iqiyi.com';
class QiyiSdk {
constructor(options = {}) {
const {
appKey,
appSecret,
managerUrl,
uploadUrl,
const defaultManagerUrl = 'https://openapi.iqiyi.com';
const defaultUploadUrl = 'https://upload.iqiyi.com';
class QiyiSdk {
constructor(options = {}) {
const {
appKey,
appSecret,
managerUrl,
uploadUrl,
var reg1 = getRegExp('\[[\'\"]', 'g');
var reg2 = getRegExp('[\'\"]\]', 'g');
function deepGet(object, path, defaultValue) {
var pathAry = path.replace(reg1, '.').replace(reg2, '').split('.');
if (pathAry[0] === '') {
pathAry.shift();
}
return pathAry.reduce(function (o, k) {
return o && o[k];
@Dafrok
Dafrok / pack.js
Last active November 13, 2018 08:00
/**
* @file 在内存中打包 zip 文件的类,需要设置 `/var/run/${namespace}` 的权限为777
* @author o.o@mug.dog
*/
import * as fs from 'fs';
import * as path from 'path';
import * as mkdirp from 'mkdirp';
import * as archiver from 'archiver';
import * as copydir from 'copy-dir';
@Dafrok
Dafrok / gender.js
Last active November 12, 2018 10:28
const id = '4199292455301996'
let page = 0
async function getUidList() {
const result = []
let isEnd = false
while (!isEnd) {
const response = await fetch(`/api/comments/show?id=${id}&page=${page}`).then(res => res.json())
if (response.data) {
const data = response.data.data
@Dafrok
Dafrok / shuffle.js
Created May 12, 2016 03:29
shuffle
function shuffle(ary) {
let times = ary.length
while (times) {
ary.push(ary.splice(0 | Math.random() * times, 1)[0])
times--
}
return ary
}
@Dafrok
Dafrok / clone.js
Last active October 12, 2017 02:26
deep copy function
function clone (obj) {
let ret
switch (Object.prototype.toString.call(obj).slice(8, -1)) {
case 'Array':
return obj.map(val => clone(val))
case 'Set':
case 'WeakSet':
ret = []
obj.forEach(val => ret.push(clone(val)))
return new Set(ret)
@Dafrok
Dafrok / ta.js
Last active September 15, 2017 02:31
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!
@Dafrok
Dafrok / timeDec.js
Last active September 14, 2017 08:43
function timeDec(t1, t2) {
const DAY = 24 * 60 * 60 * 1000
const SPACING = DAY * 7 / 24
const t = d => ((r = new Date(d), (22<= r < 6) ? new Date(r.setHours(22)) : r >= 0 ? new Date(r - DAY) : new Date(r)).getTime())
const dec = t(t1) - t(t2)
return Math.abs(dec- ((dec / DAY) | 0) * SPACING)
}