Skip to content

Instantly share code, notes, and snippets.

View jamesrochabrun's full-sized avatar
🇵🇪

James Rochabrun jamesrochabrun

🇵🇪
View GitHub Profile
extension KairosAPI {
/*
Takes a photo and returns the facial features it finds.To detect faces, all you need to do is submit a JPG or PNG photo. You can submit the photo either as a publicly accessible URL or Base64 encoded.Finally, we have some advanced options available for your use. We have set these options to sensible defaults, but sometimes there is a need to override them and we have provided that facility for you.One additional thing to note is that the returned coordinates all begin at the top left of the photo.
*/
typealias CompletionHandler = (Response<String>) -> Void
func detect(_ image: UIImage, completion: @escaping CompletionHandler ) {
struct KairosConfig {
/// HERE GOES YOUR KEY AND ID
static let app_id = ""
static let app_key = ""
}
public class KairosAPI {
let api_url: String = "https://api.kairos.com/"
let app_id: String
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
// Big O notation linear vs constant
@jamesrochabrun
jamesrochabrun / GroupingFunction.swift
Created January 13, 2018 21:33
Grouping function in Swift 4
//: Playground - noun: a place where people can play
struct Person {
let firstName: String
let lastName: String
let age: Int
}
let people = [
SwiftLint defintion
Linting is the process of running a program that will analyse code for potential errors.
Lint as a term can also refer more broadly to syntactic discrepancies in general, especially in interpreted languages like JavaScript and Python. For example, modern lint checkers are often used to find code that does not correspond to certain style guidelines.
Wikipedia link
https://en.wikipedia.org/wiki/Lint_%28software%29
SWiftLint what is it?
//: Playground - noun: a place where people can play
import UIKit
//ENUMS
enum Day {
case monday
{
results: [
{
vote_count: 2291,
id: 284053,
video: false,
vote_average: 7.5,
title: "Thor: Ragnarok",
popularity: 676.992626,
poster_path: "/oSLd5GYGsiGgzDPKTwQh7wamO8t.jpg",
//
// KMCardImagetray.swift
// KodakMoments
//
// Created by james rochabrun on 9/26/17.
// Copyright © 2017 Kodak Alaris Inc. All rights reserved.
//
import Foundation
import UIKit
protocol StringSubscriptable {
}
extension StringSubscriptable where Self: Character {
subscript (i: Int) -> Character {
return self[index(startIndex, offsetBy: i)]
}
subscript (i: Int) -> String {
class ViewController: UIViewController {
@IBOutlet weak var redView: UIView! {
didSet {
//redView.transform = CGAffineTransform(scaleX: 0.8, y: 0.8)
}
}
@IBOutlet weak var greenView: UIView!