Skip to content

Instantly share code, notes, and snippets.

@MisanthropicBit
MisanthropicBit / mtg.py
Last active September 16, 2021 23:38
Find a Magic: The Gathering card by name and show it via iTerm2's imgcat (requires python 3.3+)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Query a Magic: The Gathering card and show it via iTerm2's imgcat."""
import mtgsdk
import shutil
import subprocess
import sys
@MisanthropicBit
MisanthropicBit / Enumerator for C++11
Created November 28, 2013 17:17
C++11 convenience class that mimics the Python enumerate function for range-based for-loops.
#include <iterator>
#include <type_traits>
// Inspired by:
// http://stackoverflow.com/questions/10962290/find-position-of-element-in-c11-range-based-for-loop
template<typename T>
class Enumerator final {
public:
class iterator {
private: