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
// tslint:disable: max-classes-per-file | |
class TreeNode { | |
public left: TreeNode = null; | |
public right: TreeNode = null; | |
constructor(public data) { | |
this.data = data; | |
this.left = null; | |
this.right = 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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "attach", | |
"protocol": "inspector", | |
"name": "Attach", | |
"port": 9229 | |
} |
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
{ | |
"profiles": [ | |
{ | |
"guid": "{61c54bbd-c2c6-5271-96e7-109a87ff44be}", | |
"name": "Git Bash", | |
"commandline": "%ProgramFiles%\\Git\\bin\\bash.exe --login -i", | |
"icon": "%ProgramFiles%\\Git\\mingw64\\share\\git\\git-for-windows.ico", | |
"startingDirectory": "%USERPROFILE%", | |
"hidden": false | |
}, |
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
syntax on | |
set autoindent | |
set expandtab | |
set tabstop=2 | |
set sw=2 | |
set showcmd | |
set shortmess=at | |
set nowritebackup |
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
# Path to the profile when installed from the Windows Store. | |
$profilePath = "C:\Users\$Env:Username\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json" | |
# remove comments | |
$profile = (Get-Content $ProfilePath) -replace '(?m)(?<=^([^"]|"[^"]*")*)//.*' -replace '(?ms)/\*.*?\*/' | Out-String | ConvertFrom-Json | |
$backupProfilePath = "$home\Documents\WindowsTerminalprofiles.json" | |
Write-Verbose "Backing up profile to $backupProfilePath" | |
$profile | ConvertTo-Json | Set-Content $backupProfilePath |
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
if (typeof Storage === 'undefined') { | |
window.localStorage = {}; | |
localStorage.setItem = function (key, val) { | |
this[key] = val; | |
}; | |
localStorage.getItem = function (key) { | |
return this[key]; | |
}; | |
window.localStorage.setObject = function (key, value) { | |
this[key] = value; |
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
window.addEventListener("beforeunload", function (event) { | |
if (!checkSomething()) { // 假设已存在此方法 | |
// 标准 | |
event.preventDefault(); | |
// Chrome需要 | |
event.returnValue = ''; | |
} | |
}); |
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
/** | |
* 使object可遍历 | |
* @param {Object} obj 需要处理的object | |
*/ | |
function* objectEntries(obj) { | |
const propKeys = Reflect.ownKeys(obj); | |
for(const propKey of propKeys) { | |
yield [propKey, obj[propKey]]; | |
} | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 timeoutPromise(timeout) { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve, timeout); | |
}); | |
} | |
request(url, options, timeout) { | |
const defaultOptions = { | |
credentials: 'include', | |
}; |