Skip to content

Instantly share code, notes, and snippets.

@thejohnhoffer
thejohnhoffer / index.html
Last active April 4, 2022 17:20
Custom auto-hyperlink tables in Minerva Story
<!DOCTYPE html>
<html lang="en-US" class="h-100">
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>

[Return to the template][HOME]

This replaces a feature that react-router-dom@6 lost in the upgrade from history@4 to history@5. Basically, this restores the ability to have a window.location.hash of #something instead of #/something.

In response to a core React Router dev's suggestion, @jtojnar showed that basename="" doesn't match the old hashType="noslash" feature. I asked for that option as a new feature, and I [implemented it][2]. This was closed, so I tried a sencod implementation, which also was not accpeted.

My third attempt involved two repositories, history and React Router. I added a hashRoot parameter to replicate the old hashType behavior in history. A react rou

@thejohnhoffer
thejohnhoffer / barchart.csv
Last active March 23, 2021 17:43
Example CSV files for infovis data
type frequency
Tumor 23000
Stroma 25000
Immune 32000
Other 28000
''' Create imgData result from metadata.xml
'''
from functools import reduce
import xml.etree.ElementTree as ET
import json
XSD = {
'ome': 'http://www.openmicroscopy.org/Schemas/OME/2016-06'
}
from warnings import warn
from multiprocessing.pool import ThreadPool
from io import BytesIO
import numpy as np
import boto3
import cv2
import os
######
# Copyright (C) 2011, the scikit-image team
''' Test to crop all tiles in a region
'''
import argparse
import pathlib
import urllib
import struct
import json
import sys
import ssl
import re
@thejohnhoffer
thejohnhoffer / find_combos.py
Last active March 15, 2017 14:10
Find combos of attributes each with any possible number of values
# coding: utf-8
import numpy as np
bases = [2,3,5,3]
nb = len(bases)
rnb = range(nb)
# Get scale factors
def get_scale(i):
@thejohnhoffer
thejohnhoffer / notebook_importing.py
Created January 4, 2017 16:24 — forked from robclewley/notebook_importing.py
Module to import from ipython notebooks
"""
Module directly collated from
http://nbviewer.ipython.org/github/adrn/ipython/blob/1.x/examples/notebooks/Importing%20Notebooks.ipynb
"""
import io, os, sys, types
from IPython.nbformat import current
from IPython.core.interactiveshell import InteractiveShell
def find_notebook(fullname, path=None):
"""find a notebook, given its fully qualified name and an optional path