Skip to content

Instantly share code, notes, and snippets.

View jzmiller1's full-sized avatar
🎯
Focusing

Zac Miller jzmiller1

🎯
Focusing
View GitHub Profile
@jzmiller1
jzmiller1 / remerge.py
Created June 29, 2016 17:05 — forked from mahmoud/remerge.py
Recursively merging dictionaries with boltons.iterutils.remap. Useful for @hynek's configs. https://twitter.com/hynek/status/696720593002041345
"""
This is an extension of the technique first detailed here:
http://sedimental.org/remap.html#add_common_keys
In short, it calls remap on each container, back to front, using the accumulating
previous values as the default for the current iteration.
"""
@jzmiller1
jzmiller1 / example_code.py
Created June 4, 2016 05:30
Terrible Things
class UUIDIdMixin(models.Model):
class Meta:
abstract = True
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
class Body(UUIDIdMixin):
name = models.CharField(max_length=140)
description = models.CharField(max_length=280)