Use these rapid keyboard shortcuts to control the GitHub Atom text editor on Mac OSX.
- ⌘ : Command key
- ⌃ : Control key
- ⌫ : Delete key
- ← : Left arrow key
- → : Right arrow key
| let str = 'PathofExile \nThe world path of Game'; | |
| // match: Reg with/withou `g` flag | |
| let reg = /(path)\s*/ig; | |
| let reg2 = /(path)\s*/i; | |
| let result1 = str.match(reg); | |
| console.log(reg.lastIndex); // 0 |
| The expression will only match from its `lastIndex` position and `ignores` the global (g) flag if set. | |
| let reg = /^foo/y; | |
| let reg2 = new RegExp(reg.source, 'my'); | |
| reg.test('foo'); // false | |
| reg.lastIndex = 1; |
| /* | |
| * ul insert 1000 li tag | |
| */ | |
| let ul = document.querySelectorAll('.list'); | |
| console.time('no frag'); | |
| for(let i = 0; i < 1000; ++i) { | |
| let li = document.createElement('li'); | |
| li.textContent = 'No ' + i; | |
| ul[0].appendChild(li); | |
| } |
| /** | |
| * 题目要求! | |
| * function repeat (func, times, wait) { | |
| * } | |
| * 这个函数能返回一个新函数,比如这样用 | |
| * var repeatedFun = repeat(alert, 10, 5000) | |
| * 调用这个 repeatedFun ("hellworld") | |
| * 会alert十次 helloworld, `每次`间隔5秒 | |
| */ |
| /* | |
| * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test | |
| * Jack(?!Chen) | |
| * Negative lookahead | only mach Jack OR Jack+(anything not match `Chen`) | |
| */ | |
| let str = 'JackBlack is not my friend.'; | |
| let tmpStr = 'JackChen is my friend.'; | |
| let withoutG= /Jack(?!Chen)/; | |
| let withG = /Jack(?!Chen)/g; |
Use these rapid keyboard shortcuts to control the GitHub Atom text editor on Mac OSX.
| # Refer Page: https://erocode.com/2017/12/08/mac-os-lost-user/ | |
| # === Reboot Mac in real Root mode === | |
| reboot => holding Command + S(uper) | |
| /sbin/mount -uaw | |
| rm var/db/.AppleSetupDone | |
| reboot |
| let strA = 'JackChen is my friend.'; | |
| let strB = 'JackBlack is not my friend.'; | |
| // x(?=y) x is followed by y | |
| let regX = /Jack(?=Chen)/g; | |
| console.log(regX.test(strA)); // true | |
| console.log(regX.test(strB)); // false |
| function isInt(i) { | |
| return (typeof i == "number") && !(i % 1) && !isNaN(i); | |
| } |
| /* package.json */ | |
| { | |
| /* add --mode in webpack4.x */ | |
| "scripts": { | |
| "dev": "cross-env DEBUG=true webpack-dev-server --open", | |
| }, | |
| /* ... */ | |
| } |