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
#!/usr/bin/swift | |
import Foundation | |
func timeit(_ f:() -> ()) { | |
let s = Date() | |
f() | |
let e = String(format:"time: %.4fms", s.timeIntervalSinceNow * -1000) | |
print(e) | |
} |
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 Foundation | |
// 큰 수 덧셈과 곱셈은 특정 단위의 다항식처럼 처리한다. | |
/*: 큰 수를 다항식처럼 다룰 때, 하나의 항을 표현하는 타입. | |
각 항은 0~9999999999 까지의 값을 가지며, 차수를 나타내는 값을 별도로 가지고 있다. | |
*/ | |
struct Node { | |
static let unitSize = 10000_00000 | |
let level : Int | |
let value : Int |
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
/// Polynomial.swift | |
import Cocoa | |
fileprivate let HOPS = 100 | |
fileprivate RANDFLOAT: () -> CGFloat = { | |
return CGFloat(arc4random % 128) % 128.0 | |
} | |
fileprivate let funcRect = CGRect(x: -20, y: -20, width: 40, height: 40) |
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
{ | |
"name": "no name", | |
"raise": 0.100000001490116 | |
} |
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
// | |
// ViewController.swift | |
// DragTable | |
// | |
// Created by Anna Kim on 2017. 2. 9.. | |
// Copyright © 2017년 Anna Kim. All rights reserved. | |
// | |
import Cocoa |
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
// | |
// BigLetterView.swift | |
// TypingTutor | |
// | |
// Created by BONGSOO KWON on 2017. 2. 6.. | |
// Copyright © 2017년 BONGSOO KWON. All rights reserved. | |
// | |
import Cocoa |
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
//: Playground - noun: a place where people can play | |
import Cocoa | |
import PlaygroundSupport | |
let imageView = NSImageView(frame:NSRect(x:0, y:0, width:100, height:100)) | |
let pb = NSPasteboard.general() |
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 Cocoa | |
class Person: NSObject, NSCoding, NSPasteboardWriting, NSPasteboardReading | |
{ | |
//: 기본적인 프로퍼티는 3개. NSString, NSNumber가 아닌 Swift 타입으로 했음. | |
var firstName: String | |
var lastName: String | |
var age: Int |
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 Foundation | |
class StreamReader { | |
let encoding: String.Encoding | |
let chunkSize: Int | |
let fileHandle: FileHandle | |
var buffer: Data | |
let delimPattern : Data | |
var isAtEOF: Bool = 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
import UIKit | |
import PlaygroundSupport | |
class Controller: NSObject { | |
var button: UIButton | |
var label: UILabel | |
var view: UIView | |
var count: Int = 0 { |