Skip to content

Instantly share code, notes, and snippets.

@xyzdata
Last active August 9, 2021 02:57
Show Gist options
  • Save xyzdata/d8b3cb0246d881dcf580df4745ad7920 to your computer and use it in GitHub Desktop.
Save xyzdata/d8b3cb0246d881dcf580df4745ad7920 to your computer and use it in GitHub Desktop.
VS code setting.json & React JS

VS code setting.json

将设置放入此文件中以覆盖默认设置

https://code.visualstudio.com/docs/languages/overview

https://code.visualstudio.com/docs/languages/javascript

https://code.visualstudio.com/docs/getstarted/settings

React JS

VS code setting.json

{
    "files.exclude": {
        "**/.git": true,
        "**/.DS_Store": true,
        "jspm_packages": true,
        "node_modules": true
    },
    "search.exclude": {
        "**/node_modules": true,
        "**/bower_components": true
    },
    "files.watcherExclude": {
        "**/.git/objects/**": true,
        "**/.git/subtree-cache/**": true,
        "**/node_modules/*/**": true
    },
    "editor.formatOnSave": false,
    "editor.renderWhitespace": "all",
    "editor.fontSize": 14,
    "editor.tabSize": 4,
    "editor.multiCursorModifier": "alt",
    "editor.wordWrap": "on",
    "editor.insertSpaces": true,
    "files.encoding": "utf8",
    "terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
    "[typescript]": {
        "editor.formatOnSave": true,
        "editor.formatOnPaste": true
    },
    "[markdown]": {
        "editor.formatOnSave": true,
        "editor.renderWhitespace": "all",
        "editor.acceptSuggestionOnEnter": "off"
    },
    "files.associations": {
        "*.jsx": "JavaScript React",
        "*.js": "javascriptreact"
    }
}
@xyzdata
Copy link
Author

xyzdata commented Jun 20, 2017

// 将设置放入此文件中以覆盖默认设置
{
    "files.exclude": {
        "**/.git": true,
        "**/.DS_Store": true,
        "jspm_packages": true,
        "node_modules": true
    },
    "search.exclude": {
        "**/node_modules": true,
        "**/bower_components": true
    },
    "files.watcherExclude": {
        "**/.git/objects/**": true,
        "**/.git/subtree-cache/**": true,
        "**/node_modules/*/**": true
    },
    "editor.renderWhitespace": "all",
    "editor.fontSize": 14,
    "editor.tabSize": 4,
    "editor.multiCursorModifier": "alt",
    "editor.wordWrap": "on",
    "editor.insertSpaces": true,
    "files.encoding": "utf8",
    "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
}

@xyzdata
Copy link
Author

xyzdata commented Jun 20, 2017

VS code setting.json

https://code.visualstudio.com/docs/languages/overview

https://code.visualstudio.com/docs/languages/javascript

https://code.visualstudio.com/docs/getstarted/settings

React JS

// 将设置放入此文件中以覆盖默认设置
{
    "files.exclude": {
        "**/.git": true,
        "**/.DS_Store": true,
        "jspm_packages": true,
        "node_modules": true
    },
    "search.exclude": {
        "**/node_modules": true,
        "**/bower_components": true
    },
    "files.watcherExclude": {
        "**/.git/objects/**": true,
        "**/.git/subtree-cache/**": true,
        "**/node_modules/*/**": true
    },
    "editor.formatOnSave": false,
    "editor.renderWhitespace": "all",
    "editor.fontSize": 14,
    "editor.tabSize": 4,
    "editor.multiCursorModifier": "alt",
    "editor.wordWrap": "on",
    "editor.insertSpaces": true,
    "files.encoding": "utf8",
    "terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
    "[typescript]": {
        "editor.formatOnSave": true,
        "editor.formatOnPaste": true
    },
    "[markdown]": {
        "editor.formatOnSave": true,
        "editor.renderWhitespace": "all",
        "editor.acceptSuggestionOnEnter": "off"
    },
    "files.associations": {
        "*.jsx": "JavaScript React",
        "*.js": "javascriptreact"
    }
}

@xyzdata
Copy link
Author

xyzdata commented Jun 20, 2017

// 将设置放入此文件中以覆盖默认设置
{
    "files.exclude": {
        "**/.git": true,
        "**/.DS_Store": true,
        "jspm_packages": true,
        "node_modules": true
    },
    "search.exclude": {
        "**/node_modules": true,
        "**/bower_components": true
    },
    "files.watcherExclude": {
        "**/.git/objects/**": true,
        "**/.git/subtree-cache/**": true,
        "**/node_modules/*/**": true
    },
    "editor.formatOnSave": false,
    "editor.renderWhitespace": "all",
    "editor.fontSize": 14,
    "editor.tabSize": 4,
    "editor.multiCursorModifier": "alt",
    "editor.wordWrap": "on",
    "editor.insertSpaces": true,
    "files.encoding": "utf8",
    "terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
    "files.associations": {
        "*.js": "javascriptreact"
    }
}

@xgqfrms-GitHub
Copy link

cors

// "Access-Control-Allow-Origin", "*"

// "Access-Control-Allow-Origin": "*",


/*
https://gist.github.com/xgqfrms-GitHub/0d36bd446ecb639d5b3b3c7e2e64cf81

https://gist.github.com/xgqfrms-GitHub/a3fcffb6d7923e2a7471041053f00162

https://gist.github.com/xgqfrms-GitHub/b44ba9049575654e36e3032c58576931

*/


fetch('https://cdn.xgqfrms.xyz/json/cats.json', {
    method: 'get',
    headers: {
        'Accept': 'application/json',
        "Access-Control-Allow-Origin": "*",
        'Content-Type': 'application/json'
    }
}).then(function(response) {
    return response.json()
}).then(function(json) {
    console.log('parsed json: ', json)
}).catch(function(error) {
    console.log('parsing failed: ', error)
});


fetch('https://cdn.xgqfrms.xyz/json/cats.json', {
    method: 'get'
}).then(function(response) {
    return response.json()
}).then(function(json) {
    console.log('parsed json: ', json)
}).catch(function(error) {
    console.log('parsing failed: ', error)
});



fetch('https://newsapi.org/v1/articles?source=the-next-web&sortBy=latest', {
    method: 'get',
    headers: {
        'Accept': 'application/json',
        "Access-Control-Allow-Origin": "*",
        'Content-Type': 'application/json',
        'X-Api-Key': `0987b00e542141369049e647701b65d9`
    }
}).then(function(response) {
    return response.json()
}).then(function(json) {
    console.log('parsed json: ', json)
}).catch(function(error) {
    console.log('parsing failed: ', error)
});




fetch('https://newsapi.org/v1/articles?source=the-next-web&sortBy=latest&apiKey=0987b00e542141369049e647701b65d9', {
    method: 'get'
}).then(function(response) {
    return response.json()
}).then(function(json) {
    console.log('parsed json: ', json)
}).catch(function(error) {
    console.log('parsing failed: ', error)
});

@xgqfrms-GitHub
Copy link

xgqfrms-GitHub commented Jun 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment