Skip to content

Instantly share code, notes, and snippets.

@bragma
bragma / ApiClient.js
Last active December 12, 2023 07:59
My take on 401/token refresh axios interceptor - use promises' implicit queue to retry all pending requests awaiting on a shared promise
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 December 5, 2014 10:12
SetUp Fixture for NUnit starting the emulator before tests
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 August 29, 2015 14:09
xUnit test for Hyde: try storing DateTime.MaxValue
[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();