**~~ NOTE: This is a Stage 0 proposal. ~~**
This proposal has been moved to https://github.com/jeffmo/es-class-properties.
Please direct all future feedback to that repo in the form of directed issues.
| (function(console) { | |
| console.save = function(data, filename = 'data.json', jsonIndent = 2) { | |
| // 检查是否传入了有效的数据 | |
| if (!data) { | |
| console.error('Console.save: No data provided.'); | |
| return; | |
| } | |
| // 将数据转换为 JSON 字符串 | |
| let json = JSON.stringify(data, null, jsonIndent); // 使用 4 个空格进行格式化 |
| /** | |
| * RuntimeGlobalsChecker | |
| * | |
| * You can use this utility to quickly check what variables have been added (or | |
| * leaked) to the global window object at runtime (by JavaScript code). | |
| * By running this code, the globals checker itself is attached as a singleton | |
| * to the window object as "__runtimeGlobalsChecker__". | |
| * You can check the runtime globals programmatically at any time by invoking | |
| * "window.__runtimeGlobalsChecker__.getRuntimeGlobals()". | |
| * |
| # 只 clone 最新的代码,不要 commits/tags... | |
| git clone https://xxx/xxx.git --depth 1 | |
| # 这称为 shallow clone | |
| # 如果后面又需要完整的仓库 | |
| git pull --unshallow | |
| # === 恢复数据 === | |
| # reflog 可以查看你每次 git 操作后的 hash | |
| git reflog |
| { | |
| "theme": "light", | |
| "autoUpdate": false, | |
| "snippet": { | |
| "expanded": true, | |
| "newSnippetPrivate": false, | |
| "sorting": "updated_at", | |
| "sortingReverse": true | |
| }, | |
| "editor" : { |
| const toUnicode = (str) => str.split('').map((char) => { | |
| const temp = char.charCodeAt(0).toString(16).toUpperCase(); | |
| if (temp.length > 2) { | |
| return '\\u' + temp; | |
| } | |
| return char; | |
| }).join(''); | |
| console.log(toUnicode('转换成 Unicode')); |
**~~ NOTE: This is a Stage 0 proposal. ~~**
Please direct all future feedback to that repo in the form of directed issues.
| //http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
| Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); |
| #!/usr/bin/env node | |
| /* | |
| PO parser from http://jsgettext.berlios.de/lib/Gettext.js | |
| adapted for Node.js and modified to be more like po2json.pl | |
| - Zach Carter <[email protected]> | |
| */ | |
| /* | |
| Pure Javascript implementation of Uniforum message translation. |