看来 jQuery 你已经用得很爽了,想学习如何自己编写插件。非常好,这篇文档正适合你。用插件和方法来扩展 jQuery 非常强大,把最聪明的功能封装到插件中可以为你及团队节省大量开发时间。
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
/** | |
* @param {Number} sec Sleep second period. | |
*/ | |
function sleep(sec) { | |
sec = +sec; | |
if (isNaN(sec)) { | |
throw new Error('sleep(): arg "sec" must be a number.'); | |
} | |
const startTime = Date.now(); |
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
/** | |
* 依次读取文件 A、B、C | |
*/ | |
/** | |
* 4. async-await | |
*/ | |
const fs = require('fs'), | |
promisedReadFile = util.promisify(fs.readFile); // util.promisify: Node v8.x.x 新增 API |
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
封装环境:nginx + node.js + mysql + redis + memcached + php + php-fpm | |
配置文件路径: | |
/etc/ssh/sshd_config | |
/etc/nginx/ | |
/etc/my.cnf (/etc/mysql/my.cnf /usr/local/mysql/my.cnf ~/.my.cnf) | |
/etc/redis/ | |
/etc/php.ini > /usr/local/etc/php5214.ini | |
/etc/php-fpm.conf | |
远程 |
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
# extra/httpd-default.conf | |
# 这个配置文件展示 Apache HTTP Server 的默认设置 | |
# | |
# 你可能变更这些,但是一般情况下你并不需要更改 | |
# Timeout:收发超时前的秒数 | |
Timeout 60 | |
# KeepAlive:是否允许持续连接(每个连接可以有多次请求)—— 即不立即分手 |
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
<script\x20type="text/javascript">javascript:alert(1);</script> | |
<script\x3Etype="text/javascript">javascript:alert(1);</script> | |
<script\x0Dtype="text/javascript">javascript:alert(1);</script> | |
<script\x09type="text/javascript">javascript:alert(1);</script> | |
<script\x0Ctype="text/javascript">javascript:alert(1);</script> | |
<script\x2Ftype="text/javascript">javascript:alert(1);</script> | |
<script\x0Atype="text/javascript">javascript:alert(1);</script> | |
'`"><\x3Cscript>javascript:alert(1)</script> | |
'`"><\x00script>javascript:alert(1)</script> | |
<img src=1 href=1 onerror="javascript:alert(1)"></img> |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
elem.clientLeft
,elem.clientTop
,elem.clientWidth
,elem.clientHeight
elem.getClientRects()
,elem.getBoundingClientRect()
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 http = require('http') | |
const url = require('url') | |
const path = require('path') | |
const fs = require('fs') | |
const mime = { | |
"html": "text/html", | |
"css": "text/css", | |
"js": "text/javascript", | |
"json": "application/json", | |
"gif": "image/gif", |
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
// Wikipedia telnet server | |
// | |
// To install depenedncies: | |
// npm install request | |
// npm install cheerio | |
// | |
var net = require( 'net' ); | |
var cheerio = require('cheerio'); | |
var request = require('request'); |