This file contains 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
loghandler = logging.StreamHandler(sys.stdout) | |
loghandler.setFormatter(logging.Formatter( | |
fmt='%(asctime)s:%(name)s:%(levelname)s: %(message)s', | |
datefmt='%Y-%m-%d %H:%M:%S')) | |
rootlog = logging.getLogger() | |
rootlog.addHandler(loghandler) | |
rootlog.setLevel(logging.DEBUG) |
This file contains 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 io import StringIO | |
from xml.etree.ElementTree import ElementTree, Element, parse, ParseError | |
class XMLDict(dict): | |
'''A dictionary-like object to represent XML data.''' | |
def __init__(self, xml=None): | |
'''Expects a string containing XML data.''' | |
try: | |
self.populate(parse(StringIO(unicode(xml))).getroot()) |
This file contains 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
find -E /System/Library/Frameworks/{Foundation,Cocoa,QuartzCore}.framework \ | |
-iregex '.*/(ns|ca).+\.h$' \ | |
-exec awk '/@interface.+:/ { | |
cls = $2; | |
if (cls ~ /:$/) { | |
cls = substr(cls, 1, length(cls)-1) | |
} | |
print cls; | |
}' {} \; |
This file contains 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
// | |
// Matrices.swift | |
// Game | |
// | |
// Created by Eryn Wells on 2015-10-24. | |
// Copyright © 2015 Eryn Wells. All rights reserved. | |
// | |
/** A square matrix. */ | |
public protocol Matrix { |
This file contains 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
In [3]: number.Complex('3') | |
> /Users/eryn/Code/sibilant/sibilant/number.py(51)__init__() | |
-> exact = exact is not None | |
(Pdb) c | |
Out[3]: (3+0j) | |
In [4]: number.Complex('3#') | |
--------------------------------------------------------------------------- | |
ValueError Traceback (most recent call last) | |
<ipython-input-4-4dce8b9d03a9> in <module>() |
This file contains 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
protocol Matrix { | |
typealias ElementType | |
static func dimensions() -> (rows: Int, cols: Int) | |
static func size() -> Int | |
init() | |
subscript(row: Int, col: Int) -> ElementType { get set } | |
} |
This file contains 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
# Description: | |
# Countdown timer. Starts at the specified number and counts down to 0. | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: |
This file contains 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
import Foundation | |
public protocol AlmostEquatable { | |
@warn_unused_result | |
func ==~(lhs: Self, rhs: Self) -> Bool | |
} | |
public protocol EquatableWithinEpsilon: Strideable { | |
static var Epsilon: Self.Stride { get } | |
} |
OlderNewer