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 Cocoa | |
struct Constraint { | |
typealias T = (attribute: CAConstraintAttribute, relativeTo:String, relatedAttribute: CAConstraintAttribute, offset: CGFloat) | |
let data: T | |
func create() -> CAConstraint { | |
let newConstraint: AnyObject! = CAConstraint.constraintWithAttribute(data.attribute, relativeTo: data.relativeTo, attribute: data.relatedAttribute, offset: data.offset) | |
return newConstraint as CAConstraint | |
} |
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 Cocoa | |
struct Constraint { | |
typealias T = (attribute: CAConstraintAttribute, relativeTo:String, relatedAttribute: CAConstraintAttribute, offset: CGFloat) | |
let data: T | |
func create() -> CAConstraint { | |
let newConstraint: AnyObject! = CAConstraint.constraintWithAttribute(data.attribute, relativeTo: data.relativeTo, attribute: data.relatedAttribute, offset: data.offset) | |
return newConstraint as CAConstraint | |
} |
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 XCPlayground | |
import UIKit | |
import Framework3 | |
XCPSetExecutionShouldContinueIndefinitely() | |
var r = request(.GET, "http://en.lichess.org/api/user/peropaal") | |
.response { (request, response, data, error) in | |
println(request) | |
println() |
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 UIKit | |
import XCPlayground | |
import Framework2 | |
enum PlayerPerspective { | |
case Black, White | |
} | |
class SampleChessBoardView : UIView { | |
var margin: CGFloat = 15 |
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
#!/bin/sh | |
# Some things taken from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Set the colours you can use | |
black='\033[0;30m' | |
white='\033[0;37m' | |
red='\033[0;31m' | |
green='\033[0;32m' |
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
//Swift 2.0 | |
import Foundation | |
protocol vcProtocol { | |
func hidePuzzleMessage() | |
func showPuzzleMessage() | |
func prepareBoard() | |
} | |
class ViewController: vcProtocol { |
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
// | |
// SceneStateMachine.swift | |
// Troup | |
// | |
// Created by Chris Patrick Schreiner on 04.02.15. | |
// | |
// | |
import Foundation | |
import SpriteKit |
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
class ST_Initial: ST_Root { | |
var selection = NodeSelection() | |
override var stateName:String {return "Singleselection"} | |
init(context: PStateMachineContext) { | |
super.init(context) | |
} | |
override func perform(f: FunctionEnum) { |
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
public let findCamelCaseStringsRegex = "([A-Z0-9]+(?=$|[A-Z][a-z0-9])|[A-Z]?[a-z0-9]+)" | |
public func find(string:String, regex:String) -> [String] { | |
var r:[String] = [] | |
var sr = string.startIndex..<string.endIndex | |
let opt = NSStringCompareOptions.RegularExpressionSearch | |
while !sr.isEmpty { | |
if let match = string.rangeOfString(regex, options:opt, range:sr) { | |
r.append(string[match]) | |
sr.startIndex = advance(sr.startIndex, distance(match.startIndex,match.endIndex)) |
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 | |
extension String { | |
func toDouble() -> Double? { | |
return NSNumberFormatter().numberFromString(self)?.doubleValue | |
} | |
} | |
public struct Place: Printable { | |
var name: String! |
OlderNewer