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
// | |
// Created by Nick Vance on 12/4/15. | |
// Copyright © 2015 ToWatchList. All rights reserved. | |
// | |
import AVKit | |
import XCDYouTubeKit | |
import TVMLKit | |
class YTPlayerViewController: AVPlayerViewController, AVPlayerViewControllerDelegate { |
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/env python2.7 | |
import random | |
import subprocess | |
class Node(object): | |
def __init__(self, key, value): | |
self.key = key | |
self.value = value |
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
extension Selector { | |
static let coffeeMadeNotification = #selector(Customer.drink(_:)) | |
} | |
class Customer { | |
@objc func drink(notification: NSNotification) { | |
print("Mmm... Coffee") | |
} | |
} |
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 FibsGenerator: GeneratorType { | |
var state = (0, 1) | |
func next() -> Int? { | |
let upcomingNumber = state.0 | |
state = (state.1, state.0 + state.1) | |
return upcomingNumber | |
} | |
} |
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
# Hello, and welcome to makefile basics. | |
# | |
# You will learn why `make` is so great, and why, despite its "weird" syntax, | |
# it is actually a highly expressive, efficient, and powerful way to build | |
# programs. | |
# | |
# Once you're done here, go to | |
# http://www.gnu.org/software/make/manual/make.html | |
# to learn SOOOO much more. |
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/perl -w | |
use strict; | |
# Makefile generator for quick compilation of Swift projects | |
# By: Roopesh Chander | |
# Thanks: Andy Matuschak | |
# Works only for swift-only projects. | |
# Usage: | |
# > perl makemake.pl | |
# > make |
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
CXXFLAGS = -g -Wall -Werror -std=c++11 | |
LDLIBS = | |
PRGM = project | |
SRCS := $(wildcard *.cpp) | |
OBJS := $(SRCS:.cpp=.o) | |
DEPS := $(OBJS:.o=.d) | |
.PHONY: all clean |
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
protocol Equatable { | |
/// Reflexive - `x == x` is `true` | |
/// Symmetric - `x == y` then `y == x` | |
/// Transitive - `x == y` and `y == z` then `x == z` | |
func ==(lhs: Self, rhs: Self) -> Bool | |
} |
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 primes(n: Int) -> [Int] { | |
var numbers = [Int](2..<n) | |
for i in 0..<n-2 { | |
guard let prime = numbers[i] where prime > 0 else { continue } | |
for multiple in stride(from: 2 * prime-2, to: n-2, by: prime) { | |
numbers[multiple] = 0 | |
} | |
} | |
return numbers.filter { $0 > 0 } | |
} |
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
protocol Component { | |
typealias M // Model | |
typealias A // Action | |
typealias C // Context | |
static func initModel() -> M | |
static func update(action: A, model: M) -> M | |
static func view(model: M, context: C, base: Base) -> Node | |
} |