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 pairs<C: CollectionType>(source: C, block: (C.Generator.Element, C.Generator.Element) -> ()) { | |
var last: C.Generator.Element? | |
for i in source { | |
if let l = last { | |
block(l, i) | |
} | |
last = i | |
} | |
} |
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
// | |
// UserDefaults.swift | |
// | |
import Foundation | |
/** | |
This is a replacement for NSCoding useful for true Swift classes so that they don't have to become Objective-C objects just to be saved easily on NSUserDefaults | |
*/ | |
public protocol UserDefaultsConvertible { |
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
import uuid, BaseHTTPServer, select, types, clipboard, console, photos, PIL, base64, urllib, webbrowser | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
try: from cStringIO import StringIO | |
except ImportError: from StringIO import StringIO | |
keep_running = True | |
base_mobileconfig = """ | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"><dict> | |
<key>PayloadContent</key><array><dict> |
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 scene import * | |
from sound import * | |
from math import * | |
from random import random | |
import clipboard | |
FONT = 'HelveticaNeue-Bold' | |
PADDING = 6 | |
COLORS = ((1,1,1),(0.8,0,0),(0,0,0.9),(0,0.7,0),(0.6,0.1,0.6),(1,0,0),(0.8,0.8,0),(0.9,0.5,0),(0.2,0.2,0.2)) | |
TEXT1_HEIGHT = 20 |