Skip to content

Instantly share code, notes, and snippets.

View hazadus's full-sized avatar
💥

Alexander Goldovsky hazadus

💥
View GitHub Profile
@hazadus
hazadus / main.py
Created September 17, 2022 10:07
Pretty print nested list/dicts
def print_collection(collection, tab):
if type(collection) == dict:
for key in collection:
print(f'{tab}"{key}": "{collection[key]}"')
if type(collection[key]) in (list, dict):
print(tab + '{')
print_collection(collection[key], tab + '\t')
print(tab + '}')
elif type(collection) == list:
for item in collection:
@hazadus
hazadus / main.py
Created September 30, 2022 14:36
unzip
import zipfile
def unzip(zip_filename):
zip_file = zipfile.ZipFile(zip_filename, 'r')
for zipped_file in zip_file.namelist():
zip_file.extract(zipped_file)
zip_file.close()
@hazadus
hazadus / reactiveRoutes.vue
Last active July 28, 2023 05:19
Reactive Routes in Nuxt 3/Vue
<script setup>
// Doesn't change when route changes
const route = useRoute();
// Changes when route changes
const path = useRoute().path;
// If we need the full route object in a reactive way, we can do this:
//
// Doesn't change when route changes