Skip to content

Instantly share code, notes, and snippets.

View dumazy's full-sized avatar

Fré Dumazy dumazy

View GitHub Profile
@dumazy
dumazy / axios.refresh_token.js
Created January 2, 2019 12:58 — forked from Godofbrowser/axios.refresh_token.1.js
Axios interceptor for refresh token when you have multiple parallel requests
// for multiple requests
let isRefreshing = false;
let failedQueue = [];
const processQueue = (error, token = null) => {
failedQueue.forEach(prom => {
if (error) {
prom.reject(error);
} else {
prom.resolve(token);
@dumazy
dumazy / AndroidLogKotlin.xml
Created September 4, 2017 18:53
Android Studio Live Templates for Log statements in Kotlin
<templateSet group="AndroidLogKotlin">
<template name="logd" value="android.util.Log.d(&quot;$CLASS_NAME$&quot;, &quot;$METHOD_NAME$ (line $LINE$): $MESSAGE$&quot;)$END$" description="Log.d statement" toReformat="false" toShortenFQNames="true">
<variable name="CLASS_NAME" expression="groovyScript(&quot;if(_1.length() &gt; 23) { return _1.substring(0, 23)} else { return _1}&quot;, kotlinClassName())" defaultValue="" alwaysStopAt="true" />
<variable name="METHOD_NAME" expression="kotlinFunctionName()" defaultValue="" alwaysStopAt="false" />
<variable name="LINE" expression="lineNumber()" defaultValue="" alwaysStopAt="false" />
<variable name="MESSAGE" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="KOTLIN_STATEMENT" value="true" />
</context>
</template>