API文档服务 https://vshaxe.github.io/vscode-extern/vscode/EventEmitter.html
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
mySprite instanceof Sprite; |
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
// | |
process.on('uncaughtException', onFatal); | |
// 未处理的process的reject | |
process.on('unhandledRejection', onFatal); | |
return require('co')(function* () { | |
yield start() | |
}).catch(onFatal); |
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
// 摘自vscode-vsce中 | |
function exec(command: string, options: IOptions = {stopOnError: true}, cancellationToken?: CancellationToken): Promise<{ stdout: string; stderr: string; }> { | |
return new Promise((c, e) => { | |
let disposeCancellationListener: Function = null; | |
const child = cp.exec(command, { ...options, encoding: 'utf8' } as any, (err, stdout: string, stderr: string) => { | |
if (disposeCancellationListener) { | |
disposeCancellationListener(); | |
disposeCancellationListener = null; |
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
// 方法1 | |
var Module = require('module'); | |
const originalLoad = Module._load; | |
// 重写require方法,用来覆盖vscode | |
Module._load = function(request, parent){ | |
if(request == 'vscode') { | |
return require('./mock/vscode'); |
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
{ | |
"db":{ | |
"host":"127.0.0.1", | |
"port":3306, | |
"user":"root", | |
"password":"", | |
"database":"crawler" | |
}, | |
"baseSite":"http://s3131212.com/links/" | |
} |
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
/* | |
* this series is write like the 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
var microTpl = { | |
render: function (tpl, data) { | |
if(!tpl || !data) { | |
throw new Error("tpl or data can't be empty, microlTpl.render"); | |
} | |
// 占位符的正则 the regex of placeholder | |
var rendered, | |
rPlaceholder = /\{([^}]+)\}/g, | |
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 relative($from, $to, $ps=DIRECTORY_SEPARATOR){ | |
$arFrom = explode($ps, rtrim($from, $ps)); | |
$arTo = explode($ps, rtrim($to, $ps)); | |
while(count($arFrom) && count($arTo) && ($arFrom[0] == $arTo[0])) | |
{ | |
array_shift($arFrom); | |
array_shift($arTo); | |
} | |
return str_pad("", count($arFrom) * 3, '..'.$ps).implode($ps, $arTo); | |
} |
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 join(from, to) { | |
var part, newPath; | |
isAbsolute = from.charAt(0) == '/', | |
pathParts = [].concat(from.split('/')).concat(to.split('/')), | |
finalParts = [], | |
skipNum = 0; | |
while( part = pathParts.pop()){ | |
if(part !== '..' && part !== '.') { | |
if(skipNum) { |