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
package main | |
import ( | |
"flag" | |
"log" | |
"database/sql" | |
_ "github.com/lib/pq" | |
) | |
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
// | |
// SegmentedControl.swift | |
// | |
// Created by Dominique d'Argent on 15/06/15. | |
// Copyright © 2015 Dominique d'Argent. All rights reserved. | |
// | |
import UIKit | |
@IBDesignable |
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
DTDKDisableSymbolCopying = YES | |
DTDKProvisioningProfileExtraSearchPaths = /Library/Server/Xcode/Data/ProvisioningProfiles | |
DVTCodesigningAllTheThingsLogLevel = 3 | |
DVTDeviceLogLevel = 3 | |
IDEBuildOperationResultBundlePath = /Library/Server/Xcode/Data/BotRuns/BotRun-ea81d563-4787-46b5-a1ea-7dabd4d300d0.bundle/output/xcodebuild_result.bundle | |
IDEBuildOperationTimingLogLevel = 2 | |
IDEDerivedDataPathOverride = /Library/Server/Xcode/Data/BotRuns/Cache/d988d2a3-6091-45b5-9eac-0bbe88e2631e/DerivedData |
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
final class Box<T> { | |
let value: T | |
init(_ value: T) { | |
self.value = value | |
} | |
} | |
protocol DataType : Printable { |
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 ViewModel | |
class Attribute | |
attr_reader :name | |
attr_accessor :model_value, :view_value | |
def initialize(name, model_value = :_undefined, view_value = :_undefined) | |
@name = name | |
@model_value = model_value | |
@view_value = view_value | |
end |
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
infix operator ??= { | |
associativity right | |
precedence 90 | |
assignment | |
} | |
func ??=<T>(inout optional: T?, defaultValue: @autoclosure () -> T?) -> T? { | |
optional = optional ?? defaultValue() |
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
// Interpol.playground | |
import CoreGraphics | |
typealias Time = CFTimeInterval | |
typealias Value = CGFloat | |
typealias Point = CGPoint | |
typealias Vector = CGVector | |
typealias Size = CGSize | |
typealias Rect = CGRect |
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
struct TakeSequenceView<Base : SequenceType> : SequenceType { | |
let base: Base | |
let n: Int | |
init(_ base: Base, n: Int) { | |
self.base = base | |
self.n = n | |
} | |
func generate() -> GeneratorOf<Base.Generator.Element> { |
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 encode<T>(var value: T) -> NSData { | |
return withUnsafePointer(&value) { p in | |
NSData(bytes: p, length: sizeofValue(value)) | |
} | |
} | |
func decode<T>(data: NSData) -> T { | |
let pointer = UnsafeMutablePointer<T>.alloc(sizeof(T.Type)) | |
data.getBytes(pointer) | |
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
infix operator < { associativity left } | |
// left-most comparison | |
func <<T : Comparable>(lhs: T, rhs: T) -> ((T, T) -> Bool, () -> T) -> Bool { | |
return { (op: (T, T) -> Bool, value: () -> T) in | |
(lhs < rhs) && op(rhs, value()) | |
} | |
} | |
// mid comparisons |