Skip to content

Instantly share code, notes, and snippets.

@TTy32
TTy32 / expand_flatdict_to_tree.py
Created November 4, 2021 09:25
A generic function to expand flat dicts
def expand_flatdict_to_tree(dict, sep = '_', to_lower = True):
tree = {}
for src, val in dict.items():
ref = tree
if to_lower:
src = src.lower()
@TTy32
TTy32 / index.html
Created March 17, 2021 10:08
Dynamic runtime baseURL for angular prod builds
<!-- Replace `<base baseHref="/">` in `index.html` with: -->
<!-- Dynamic base href -->
<base id="baseHref"> <!-- Don't fill baseHref otherwise you'll first get a request with invalid URLs -->
<script>
document.getElementById('baseHref').href = (function() {
// NOTE: URI in app module does not need a / suffix. URI in index.html does!
uri = window.location.pathname;
uri = uri.replace('index.html', '');