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 formatDate(date, formater) { | |
date = new Date(date); | |
var week = '日一二三四五六'; | |
var data = { | |
'y': date.getFullYear(), // 年 | |
'M': date.getMonth() + 1, // 月 | |
'd': date.getDate(), // 日 | |
'E': week.charAt(date.getDay()), | |
'h': date.getHours(), // 小时 |
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
var some = Array.prototype.some; | |
function hasClass1(name){ | |
if (!name) { | |
return false | |
} | |
return some.call(this, function(el){ | |
return this.test(el.className) | |
}, new RegExp('(^|\\s)' + name + '(\\s|$)')); |
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(document) { // title提示 | |
var titleTime; | |
var oldTitle = document.title; | |
var shortcut = document.getElementById('shortcut'); | |
document.addEventListener('visibilitychange', function() { | |
if (document.hidden) { | |
document.title = '(●—●)咦,去哪儿啊?'; | |
clearTimeout(titleTime); | |
shortcut.href = 'images/fail.ico'; |
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="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Test Suite</title> | |
<style> | |
#results li.pass {color: green;} | |
#results li.fail {color: red;} | |
</style> | |
</head> |
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
var nodes = document.getElementsByTagName("*"); | |
var events = []; | |
ev = lookEvents(document); | |
if (ev) { | |
events.push({el: document, ev: ev}); | |
} | |
for (var i=0, l=nodes.length; i<l; i++) { | |
var ev = lookEvents(nodes[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
npm set registry https://r.npm.taobao.org # 注册模块镜像 | |
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像 | |
## 以下选择添加 | |
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像 | |
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像 | |
npm set ELECTRON_MIRROR https://cdn.npm.taobao.org/dist/electron/ # electron 二进制包镜像 | |
npm set puppeteer_download_host https://npm.taobao.org/mirrors # puppeteer 二进制包镜像 | |
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver # chromedriver 二进制包镜像 | |
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver # operadriver 二进制包镜像 |
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
$.ajax('?', {type:'head'}).done(function(data, status, xhr) { | |
var dt = new Date(xhr.getResponseHeader('Date')); // 字符串转日期对象 | |
console.log(dt.toLocaleString()); | |
}); |
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 | |
$headers = [ // 构造IP | |
'CLIENT-IP: 8.8.8.8', | |
'X-FORWARDED-FOR: 8.8.8.8', | |
]; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:8000/server.php'); | |
curl_setopt($ch, CURLOPT_REFERER, 'http://www.baidu.com/'); // 构造来路 |
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
// 源: https://sf-static.b0.upaiyun.com/v-5703995e/global/js/debug.js | |
/* | |
监控js错误并上报 | |
[email protected] | |
*/ | |
window.onerror = function(msg, url, line, col, error) { | |
if (msg !== "Script error." && !url) { | |
return true; | |
} |
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
listen 80; | |
charset utf-8; | |
index index.html index.php; | |
error_page 404 /404.html; | |
# 开启 php 并支持 pathinfo | |
include enable-php-pathinfo.conf; | |
# yii2 rewrite |
OlderNewer