If you're using Mac OS (High Sierra or otherwise) you might have seen this error when you tried to push git code (to GitHub), especially if you tried doing so from something such as Visual Studio Code (vscode):
> git push git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights
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
199.232.69.194 github.global.ssl.fastly.net | |
140.82.113.3 github.com | |
185.199.108.153 assets-cdn.github.com | |
185.199.109.153 assets-cdn.github.com | |
185.199.110.153 assets-cdn.github.com | |
185.199.111.153 assets-cdn.github.com | |
185.199.108.133 avatars0.githubusercontent.com | |
185.199.109.133 avatars0.githubusercontent.com | |
185.199.108.133 avatars1.githubusercontent.com |
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
[mac os下vscode快捷键](https://www.cnblogs.com/informatics/p/8315339.html) | |
全局 | |
Command + Shift + P / F1 显示命令面板 | |
Command + P 快速打开 | |
Command + Shift + N 打开新窗口 | |
Command + W 关闭窗口 | |
基本 | |
Command + X 剪切(未选中文本的情况下,剪切光标所在行) | |
Command + C 复制(未选中文本的情况下,复制光标所在行) |
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 saveShareContent (content, fileName) { | |
let downLink = document.createElement('a') | |
downLink.download = fileName | |
//字符内容转换为blod地址 | |
let blob = new Blob([content]) | |
downLink.href = URL.createObjectURL(blob) | |
// 链接插入到页面 | |
document.body.appendChild(downLink) | |
downLink.click() | |
// 移除下载链接 |
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
class Modal { | |
login() { | |
console.log('login...'); | |
} | |
} | |
Modal.create = (function() { | |
let instance | |
return function() { | |
if(!instance) { | |
instance = new Modal(); |
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
class Cat { | |
say() { | |
console.log("meow ~") | |
} | |
} | |
// 实际上当我们给一个类添加一个属性的时候,会调用到 Object.defineProperty 这个方法,它会接受三个参数:target 、name 和 descriptor ,上面的Class本质等同于: | |
function Cat() {} | |
Object.defineProperty(Cat.prototype, 'say', { | |
value: function() { console.log("meow ~"); }, |
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
class Singleton { | |
constructor(name) { | |
this.name = name | |
this.instance = null | |
} | |
getName() { | |
alert(this.name) | |
} |
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
class Event { | |
constructor() { | |
this.events = []; | |
} | |
on(fn) { | |
this.events.push(fn); | |
} | |
emit(data) { |
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
// module scope start | |
// Block | |
{ // <- scope start | |
} // <- scope end | |
// Class | |
class Foo { // <- scope start |
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 deepClone(source) { | |
const target = source.constructor === Array ? [] : {}; | |
for (let keys in source) { | |
// exclude the prototype attr | |
if (source.hasOwnProperty(keys)) { | |
if (source[keys] && typeof source[keys] === 'object' ) { | |
deepClone(source[keys]); | |
} else { | |
target[keys] = source[keys]; | |
} |
NewerOlder