Skip to content

Instantly share code, notes, and snippets.

View trungnus96's full-sized avatar
🎯
Focusing

Trung Nguyen trungnus96

🎯
Focusing
  • Brauz
  • Melbourne, Australia
View GitHub Profile
@trungnus96
trungnus96 / cloudSettings
Created April 20, 2018 00:38
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-04-20T00:38:29.369Z","extensionVersion":"v2.9.0"}
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@trungnus96
trungnus96 / axios-catch-error.js
Created September 13, 2021 12:44 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@trungnus96
trungnus96 / index.js
Created July 9, 2022 15:19 — forked from patrickbolle/index.js
Shopify JS Variant Listener
/**
* This class contains general helper methods.
*/
class Helper {
/**
* @param {String} name
* @returns {String|null}
*/
static getQueryParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]')