Skip to content

Instantly share code, notes, and snippets.

@meixg
meixg / settings.json
Created June 24, 2021 03:23
两行配置解决 vscode 打开 node.js 源码 intelliSense 各种报错的问题
{
"files.associations": {
},
"C_Cpp.intelliSenseEngineFallback": "Disabled",
"C_Cpp.intelliSenseEngine": "Tag Parser"
}
# git@协议
# 在~/.ssh/config 文件后面添加几行,没有可以新建一个
Host github.com
User git
ProxyCommand nc -X 5 -x 127.0.0.1:7890 %h %p
# windows 版本
Host github.com
Host *
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
ControlPersist 600
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>tpl</string>
<string>smarty</string>
<string>html.smarty</string>
</array>
@meixg
meixg / random-string.js
Created June 21, 2019 06:07
生成随机字符串
Math.random().toString(36).substr(2, 12);
@meixg
meixg / vscode-ts-debug.json
Created June 13, 2019 03:08
VS Code 调试当前 ts 文件
{
"name": "Current TS File",
"type": "node",
"request": "launch",
"args": ["${relativeFile}"],
"runtimeArgs": ["-r", "ts-node/register"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
}
var dice = function(){
var num=3;
return function(minimum, maximum){
var t = new Date();
var number = t.getMilliseconds();
number = (number*num)%6/5;
if(num == 0){
num = 3;
}else{
num = number;
Function.prototype.before = function(beforefn){
var self = this;
return function(){
beforefn.apply(this,arguments);
return self.apply(this,arguments);
};
}
Function.prototype.after = function(afterfn){
var self = this;
Function.prototype.after = function(fn){
var self = this;
return function(){
var ret = self.apply(this,arguments);
if(ret === "nextSuccessor"){
return fn.apply(this,arguments);
}
return ret;
};
};
//一个创建宏命令的函数
var MacroCommand = function(){
return {
commandsList : [],
add : function(command){
this.commandsList.push(command);
},
execute: function(){
for(var i = 0, command; command = this.commandsList[i++];){