Skip to content

Instantly share code, notes, and snippets.

@bragma
bragma / ApiClient.js
Last active Feb 17, 2021
My take on 401/token refresh axios interceptor - use promises' implicit queue to retry all pending requests awaiting on a shared promise
View ApiClient.js
import axios from 'axios'
export default class ApiClient {
constructor(baseUrl, tokenStorage) {
this.http = axios.create({
baseURL: baseUrl
})
this.tokenStorage = tokenStorage
this.setupTokenInterceptors()
@bragma
bragma / AzureStorageEmulatorManager.cs
Created Dec 5, 2014
SetUp Fixture for NUnit starting the emulator before tests
View AzureStorageEmulatorManager.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AzureTableStorage.Tests
{
// Start/stop azure storage emulator from code:
@bragma
bragma / gist:5e81048701a743c1f7b9
Last active Aug 29, 2015
xUnit test for Hyde: try storing DateTime.MaxValue
View gist:5e81048701a743c1f7b9
[Fact]
public void TestMaxDateTime()
{
var partitionKey = "PK";
var rowKey = "RK";
var entity = new Entity { DT = DateTime.MaxValue };
_onlineStorage.Add(_tableName, entity, partitionKey, rowKey);
_onlineStorage.Save();