This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from optparse import OptionParser, Option | |
from functools import wraps | |
my_parser = OptionParser(usage = "Usage: %prog [options]") | |
approve_option = Option("-a", "--approve", default = False, action = "store_true", \ | |
help = "Must be provided along with disruptive options.") | |
class optparse_option(object): | |
# Can also accept 'ask_for_approval' argument. By default it's False. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Tree | |
attr_accessor :children, :node_name | |
def initialize(name, children=[]) | |
@node_name = name | |
@children = children | |
end | |
def visit_all(&block) | |
visit &block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func romanify(n: Int) -> String { | |
let pivotRomans = [ | |
1: "I", | |
4: "IV", | |
5: "V", | |
9: "IX", | |
10: "X", | |
40: "XL", | |
50: "L", | |
90: "XC", |