Skip to content

Instantly share code, notes, and snippets.

View amy-langley's full-sized avatar

Amy Langley amy-langley

View GitHub Profile
@moreta
moreta / http.js
Last active September 5, 2023 15:27
axios interceptor sample code
/**
* src/api/http.js
*/
import axios from 'axios'
import qs from 'qs'
/**
*
* parse error response
*/
@angelo-v
angelo-v / jwt-decode.sh
Last active October 21, 2024 13:19
Decode a JWT via command line
# will not work in all cases, see https://gist.github.com/angelo-v/e0208a18d455e2e6ea3c40ad637aac53#gistcomment-3439904
function jwt-decode() {
sed 's/\./\n/g' <<< $(cut -d. -f1,2 <<< $1) | base64 --decode | jq
}
JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ
jwt-decode $JWT
@ssippe
ssippe / cartesianProduct.ts
Created April 20, 2017 00:33
Typescript Cartesian Product
const f = (a: any[], b: any[]): any[] =>
[].concat(...a.map(a2 => b.map(b2 => [].concat(a2, b2))));
export const cartesianProduct = (a: any[], b: any[], ...c: any[]) => {
if (!b || b.length === 0) {
return a;
}
const [b2, ...c2] = c;
const fab = f(a, b);
return cartesianProduct(fab, b2, c2);
anonymous
anonymous / Main.purs
Created March 3, 2016 03:03
module Main where
import Control.Bind ((=<<))
import Control.Monad.Aff (Aff(), runAff, later')
import Control.Monad.Eff (Eff())
import Control.Monad.Eff.Exception (throwException)
import Control.Monad.List.Trans as ListT
import Control.Monad.Trampoline (Trampoline, runTrampoline)
import Data.Array (slice, insertAt, head, singleton)
import Data.Functor ((<$))
@bishboria
bishboria / springer-free-maths-books.md
Last active October 3, 2024 09:17
Springer made a bunch of books available for free, these were the direct links
@Couto
Couto / webpack.js
Last active November 7, 2024 13:10
Fetch polyfill with webpack
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};