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 (name, definition) { | |
| // test if the context is AMD or CMD | |
| var hasDefine = typeof define === 'function', | |
| // test if the context is Node | |
| hasExports = typeof module !== 'undefined' && module.exports; | |
| if (hasDefine) { | |
| // AMD or CMD | |
| define(definiton); | |
| } else if (hasExports) { |
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 http = require('http') | |
| , parse = require('url').parse; | |
| function urlget(url, callback) { | |
| var info = parse(url) | |
| , path = info.pathname + (info.search || '') | |
| , options = { host: info.hostname, port: info.port || 80, path: path, method: 'GET' }; | |
| var req = null, request_timeout = null; | |
| request_timeout = setTimeout(function() { | |
| request_timeout = null; | |
| req.abort(); |
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 http = require('http') | |
| , parse = require('url').parse; | |
| function urlget(url, callback) { | |
| var info = parse(url) | |
| , path = info.pathname + (info.search || '') | |
| , options = { host: info.hostname, port: info.port || 80, path: path, method: 'GET' }; | |
| var req = null, request_timeout = null; | |
| request_timeout = setTimeout(function() { | |
| request_timeout = null; | |
| req.abort(); |
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 parse = require('url').parse | |
| , http = require('http') | |
| , fs = require('fs'); | |
| function upload(url, uploadfile, callback) { | |
| var info = parse(url) | |
| , path = info.pathname + (info.search || '') | |
| , options = { host: info.hostname, port: info.port || 80, path: path, method: 'POST' }; | |
| var req = http.request(options, function(res) { | |
| var chunks = [], length = 0; | |
| res.on('data', function(chunk) { |
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 parse = require('url').parse | |
| , http = require('http') | |
| , fs = require('fs'); | |
| function download(url, savefile, callback) { | |
| console.log('download', url, 'to', savefile) | |
| var urlinfo = parse(url); | |
| var options = { | |
| method: 'GET', | |
| host: urlinfo.host, | |
| path: urlinfo.pathname |
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
| # 用的是 mac osx,编辑 phpstorm 的启动配置文件,其他平台根据情况选择: | |
| sudo vim /Applications/PhpStorm.app/Contents/bin/phpstorm.vmoptions | |
| # 修改参数,根据具体需要修改即可,一般修改 -Xmx(即最大可占内存)即可 | |
| -Xms512m | |
| -Xmx2048m | |
| -XX:MaxPermSize=350m | |
| -XX:ReservedCodeCacheSize=240m | |
| -XX:+UseCompressedOops |
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
| # http://editorconfig.org | |
| root = true | |
| [*] | |
| indent_style = space | |
| indent_size = 2 | |
| end_of_line = lf | |
| charset = utf-8 | |
| trim_trailing_whitespace = true | |
| insert_final_newline = 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
| ;(function(win, ctrl) { | |
| var incId = 0; | |
| function ControlName(element, options) { | |
| var that = this; | |
| var id = Date.now() + '-' + (++incId); // 每个控件有唯一的id | |
| var root = document.createDocumentFragment(); // 文档片段,用于append时提高效率 | |
| if (arguments.length === 1 && !(arguments[0] instanceof HTMLElement)) { | |
| // 参数个数的兼容判断 |
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> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta lang="zh"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
| <meta name="renderer" content="webkit"> | |
| <meta name="description" content=""> | |
| <meta name="keyword" content=""> | |
| <title>XXX</title> |
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
| body{ | |
| line-height:1.4; | |
| color:#333; | |
| font-family:arial; | |
| font-size: 12px; | |
| background:white; | |
| } | |
| input,textarea,select{ | |
| font-size:12px; | |
| font-size:100%; |