Skip to content

Instantly share code, notes, and snippets.

View shuch's full-sized avatar

六月晨光 shuch

View GitHub Profile
@shuch
shuch / vscode-git-integration.md
Created February 16, 2023 13:57 — forked from stormwild/vscode-git-integration.md
Allow Visual Studio Code to Push to Remote Repository

Visual Studio Code Git Integration

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
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
@shuch
shuch / mac os下vscode快捷键
Created October 29, 2020 02:06 — forked from wxingheng/mac os下vscode快捷键
mac os下vscode快捷键
[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 复制(未选中文本的情况下,复制光标所在行)
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()
// 移除下载链接
class Modal {
login() {
console.log('login...');
}
}
Modal.create = (function() {
let instance
return function() {
if(!instance) {
instance = new Modal();
class Cat {
say() {
console.log("meow ~")
}
}
// 实际上当我们给一个类添加一个属性的时候,会调用到 Object.defineProperty 这个方法,它会接受三个参数:target 、name 和 descriptor ,上面的Class本质等同于:
function Cat() {}
Object.defineProperty(Cat.prototype, 'say', {
value: function() { console.log("meow ~"); },
class Singleton {
constructor(name) {
this.name = name
this.instance = null
}
getName() {
alert(this.name)
}
class Event {
constructor() {
this.events = [];
}
on(fn) {
this.events.push(fn);
}
emit(data) {
@shuch
shuch / scope.js
Created May 8, 2020 12:41 — forked from vincentdchan/scope.js
Scope Analysis
// module scope start
// Block
{ // <- scope start
} // <- scope end
// Class
class Foo { // <- scope start
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];
}