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 | |
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { | |
@IBOutlet weak var tableView: UITableView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
NSLayoutConstraint.activate([ | |
tableView.topAnchor.constraint(equalTo: view.topAnchor), |
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
extension Optional { | |
func both_then<T, U>(_ other: Optional<U>, f: (Wrapped, U) -> T) -> Optional<T> { | |
guard let a = self, let b = other else { return nil } | |
return f(a, b) | |
} | |
func neither<T>(_ other: Optional<T>) -> Bool { | |
return self == nil && other == nil | |
} |
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 Person { | |
var name: String = "John" | |
var age: Int = 50 | |
var dutch: Bool = false | |
var address: Address? = Address(street: "Market St.") | |
} | |
struct Address { |
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-KVO | |
// | |
// Created by Jim Correia on 6/5/14. | |
// Copyright (c) 2014-2015 Jim Correia. All rights reserved. | |
// | |
// Update: 6/17/2014 | |
// | |
// KVOContext has gone away; use the same idiom you'd use from Objective-C for the context | |
// |
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
require 'net/http' | |
require 'open-uri' | |
require 'json' | |
screen_name = ARGV[0] | |
if screen_name.nil? | |
puts "ruby twitter_friends_on_alpha.rb twitter_username" | |
exit | |
end |
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
# Main controller for the Tomtelizer | |
# | |
class TomtelizerViewController < UIViewController | |
# Load the view | |
# | |
def loadView | |
self.view = UIImageView.alloc.init | |
@debug_face = false | |
end |