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
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Hello World</title> | |
<script src="https://unpkg.com/[email protected]/umd/react.production.min.js"></script> | |
<script src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js"></script> | |
<script src="https://unpkg.com/@babel/[email protected]/babel.min.js"></script> | |
</head> | |
<body> | |
<div id="root"></div> |
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
.box { | |
width: 30px; | |
height: 30px; | |
background: yellowgreen; | |
border: 10px solid #655; | |
outline: 5px dashed deeppink; | |
outline-offset: -8px; | |
border-radius: 30px; | |
} |
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
" Specify a directory for plugins | |
call plug#begin('~/.vim/plugged') | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'scrooloose/nerdtree' | |
"Plug 'tsony-tsonev/nerdtree-git-plugin' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'airblade/vim-gitgutter' |
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
// https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-custom-languages | |
// Register a new language | |
monaco.languages.register({ id: 'mySpecialLanguage' }); | |
// Register a tokens provider for the language | |
monaco.languages.setMonarchTokensProvider('mySpecialLanguage', { | |
tokenizer: { | |
root: [ | |
// [/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.root' }], | |
{ include: 'phpRoot' }, |
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
# 通过url获取qs参数 | |
function getParameterByName(name, url) { | |
if (!url) url = window.location.href; | |
name = name.replace(/[\[\]]/g, '\\$&'); | |
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), | |
results = regex.exec(url); | |
if (!results) return null; | |
if (!results[2]) return ''; | |
return decodeURIComponent(results[2].replace(/\+/g, ' ')); | |
} |
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
function generateBracket(res, str, left, right) { | |
if (left > right) return; | |
console.log(`str > ${str}, left > ${left}, right > ${right}`) | |
if (left > 0) { | |
generateBracket(res, str + '(', left - 1, right); | |
} | |
if (right > 0) { | |
generateBracket(res, str + ')', left, right - 1); | |
} | |
if (left === 0 && right === 0) { |
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
/* | |
对称二叉树树 | |
1 | |
/ \ | |
2 2 | |
/ \ / \ | |
4 8 8 4 | |
*/ | |
// 对称二叉树树 |
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
var nums = [1,2,3,6,8,11]; | |
var target = 10; | |
function getTwoNumSum(nums, target) { | |
var i = 0, j = nums.length - 1; | |
while(i < j) { | |
if (nums[i] + nums[j] > target) { | |
j--; | |
} else if (nums[i] + nums[j] < target) { | |
i++; |
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
var nums = [1,2,3,6,8,11]; | |
var target = 10; | |
// 暴力破解法 O(n^2) | |
function getTwoNumSumBruteForce(nums, target) { | |
for (var i = 0; i < nums.length; i++) { | |
for (var j = i + 1; j < nums.length; j++) { | |
if (nums[i] + nums[j] === target) { | |
return [i, j] | |
} |
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
/** | |
* 回文字符串判断 | |
*/ | |
function isPalindrome(s) { | |
if (!s) return true; | |
var i = 0, j = s.length - 1; | |
for (; i < j; ++i, --j ) { | |
while (i < j && !isAlphaNumber(s[i])) ++i; | |
while(i < j && !isAlphaNumber(s[j])) --j; |
NewerOlder