Snippet List
I recently needed to sort a list of objects by cardinal direction clock-wise. Since this is different than alphabetical, and I didn't want to use a dictionary to map to integers, here is what I came up with.
There may be a cleaner way to do this by overriding some object methods, but I just thought I'd put this out there anyway.
This is an example of how I am providing downloads of dynamic images in either PNG or PDF formats. The PDF format requires ImageMagick's `convert`, and temporary disk space to save the intermediary image. If anyone knows a way to avoid writing to disk, I'd be happy to include it here.
I realize there may be uses where it isn't necessary to use the PIL Image class if the image is already stored as a file. This is used for downloading dynamic images without saving them to disk (unless pdf format is used).
- pdf
- png
- custom-response
- subprocess
gkelly has posted 2 snippets.