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
// | |
// ReceiptController.swift | |
// App | |
// | |
// Created by Justin Anderson on 3/2/19. | |
// | |
import Foundation | |
import Vapor |
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 | |
extension Array { | |
func choose(_ n: Int) -> Array { return Array(shuffled().prefix(n)) } | |
} | |
struct Ticket { | |
let numbers: [Int] | |
let bonus: 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 | |
enum Card { | |
case ace | |
case face(value: Int) | |
case jack | |
case queen | |
case king | |
} |
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
#include <stdio.h> | |
#include <stdint.h> | |
#include <emscripten/emscripten.h> | |
double EMSCRIPTEN_KEEPALIVE sq_root(double count) { | |
if (count == 0) { | |
return 1; | |
} else if (count == 1) { | |
return 2; | |
} |
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 GLKit | |
extension Float { | |
var radians: Float { | |
return GLKMathDegreesToRadians(self) | |
} | |
} | |
class Matrix4 { |
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 | |
let maxValue: UInt32 | |
if CommandLine.arguments.count >= 2 { | |
maxValue = UInt32(CommandLine.arguments[1]) ?? 100 | |
} else { | |
maxValue = 100 | |
} |
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
wget http://swift-arm.ddns.net/job/Swift-3.0-ARMv7-ubuntu1410/29/artifact/swift-3.0-2016-11-03-armv7-ubuntu14.04.tar.gz | |
mkdir swift-3.0 | |
cd swift-3.0 && tar -xzf ../swift-3.0-2016-10-21-RPi23-ubuntu16.04.tar.gz | |
export PATH=$HOME/swift-3.0/usr/bin:$PATH | |
sudo nano /etc/apt/sources.list | |
#uncomment this line | |
deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi | |
sudo apt-get update |
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
public protocol StoryboardInitialization { | |
static var storyboardIdentifier: String { get } | |
} | |
public extension UIStoryboard { | |
public func instantiateViewController<T: StoryboardInitialization>(withType classIdent: T.Type) -> T? { | |
return self.instantiateViewController(withIdentifier: classIdent.storyboardIdentifier) as? T | |
} | |
} |
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 test() -> Int { | |
func test() -> Int { | |
func test() -> Int { | |
func test() -> Int { | |
func test() -> Int { | |
func test() -> Int { | |
func test() -> Int { | |
func test() -> Int { | |
func test() -> Int { | |
func test() -> Int { |