Skip to content

Instantly share code, notes, and snippets.

View jeremydouglass's full-sized avatar

Jeremy Douglass jeremydouglass

View GitHub Profile
@g-io
g-io / Vividict.py
Last active May 10, 2018 12:31
Python autovivified nested dictionary
class Vividict(dict):
"""
dict class which allows to set deeply nested values. Any nested dict will get autovivified.
Note that using defaultdict is more performant, so in case of huge datasets revert to that one.
However using this class and not 'closing' it after setting values might result in undesired behavior:
When accessing a value which is not set, no KeyError is thrown, instead it's autovivified into an empty Vividict.
To guarantee this doesn't happen but KeyError is thrown, dictify() needs to be called to transform the data structure
into regular dicts.
@monkstone
monkstone / data.yml
Last active November 27, 2017 21:22
Reading and Writing YAML with jruby-complete.jar
---
bubbles:
- xpos: 20
ypos: 50
diameter: 200
emotion: happy
- xpos: 80
ypos: 60
diameter: 210
emotion: sad
@genekogan
genekogan / ascii-art-rnn
Created August 18, 2018 16:23
generated text from an LSTM (char-rnn-tensorflow) trained on ascii art scraped from https://www.asciiart.eu/
This file has been truncated, but you can view the full file.
.:'
..:'
.;'
.;!;
.;;;;,;;,;;,,,.
.,;;;'''''';;..,;;;,;
`'',CC;;;;;;'.....;;;.
:.............,'`...;;;;;;;.............;;\. ::::::::::
;;;;;;..,,,...,,..........;' :::::::::::;;;;;;;;;'..
:::::::::::' :: `'':::::......,,,;::::::::::::::::'
@cardil
cardil / JEP.md
Last active May 16, 2024 21:17
[Draft] JEP - Change name of imported type (aliasing)

Summary

Change name of imported type (aliasing)

Goals

The goal is to make code more productive and clean in cases where multiple classes with same name must be used in code. It should relief a developers frustration in that