Skip to content

Instantly share code, notes, and snippets.

@sueblue
sueblue / axios-interceptors-refresh-token.js
Created November 19, 2018 10:11 — forked from mkjiau/axios-interceptors-refresh-token.js
Axios interceptors for token refreshing and more than 2 async requests available
let isRefreshing = false;
let refreshSubscribers = [];
const instance = axios.create({
baseURL: Config.API_URL,
});
instance.interceptors.response.use(response => {
return response;
}, error => {
function write_ws_xml_datavalidation(validations) {
var o = '<dataValidations>';
for(var i=0; i < validations.length; i++) {
var validation = validations[i];
o += '<dataValidation type="list" allowBlank="1" sqref="' + validation.sqref + '">';
o += '<formula1>&quot;' + validation.values + '&quot;</formula1>';
o += '</dataValidation>';
}
o += '</dataValidations>';
return o;
@sueblue
sueblue / index.js
Created December 6, 2018 03:21 — forked from xemasiv/index.js
Reconnecting Websockets
var socket;
const socketMessageListener = (event) => {
console.log(event.data);
};
const socketOpenListener = (event) => {
console.log('Connected');
socket.send('hello');
};
@sueblue
sueblue / gist:3e7aaef2963e375f81f98a009c94a3b7
Created January 17, 2019 08:07 — forked from pincheira/gist:2724082
Custom override console.log to display date on every return string
function showDate(){
var date = new Date(),
str = date.toUTCString();
return str;
}
var orig = console.log;
console.log = function() {
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person