Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View eliperkins's full-sized avatar
🍞
Let’s get this bread.

Eli Perkins eliperkins

🍞
Let’s get this bread.
View GitHub Profile
@eliperkins
eliperkins / check-outdated-deps.rb
Created April 8, 2024 22:40
Find outdated dependencies in an XcodeGen-based project
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'colored2'
require 'octokit'
require 'yaml'
if ENV['GITHUB_TOKEN'].nil?
puts '❗️ GITHUB_TOKEN environment variable is not set!'.red
puts 'Supply a token from gh CLI by running `GITHUB_TOKEN=$(gh auth token) script/check-outdated-deps.rb`'
@eliperkins
eliperkins / Autoclosures.swift
Created September 21, 2022 15:26
Swift autoclosure "lazy" evaluation
struct SomeStruct {
init(someReallyExpensiveValue: @autoclosure () -> Int) {
print("really expensive")
Thread.sleep(forTimeInterval: TimeInterval(someReallyExpensiveValue() * 1))
}
init(someEvenMoreExpensiveValue: @autoclosure () -> Int) {
print("even more expensive")
Thread.sleep(forTimeInterval: TimeInterval(someEvenMoreExpensiveValue() * 5))
}
@eliperkins
eliperkins / LinearGradientView.swift
Created November 6, 2018 22:42
lol gradients in UIKit 🙃🙃🙃
import UIKit
@objc(CLBLinearGradientView)
class LinearGradientView: UIView {
@objc var layerBacked: Bool {
didSet {
switch (layerBacked, layerView) {
case (true, .none): addLayerView()
case (false, .some): removeLayerView()
default: break
@eliperkins
eliperkins / Squares.swift
Last active February 4, 2018 16:48
Generate Super Bowl Squares in a Xcode Playground
//: Playground - noun: a place where people can play
//: Super Bowl Squares - noun: free money
import Foundation
import PlaygroundSupport
enum Player: String {
case eli = "Eli"
case brian = "Brian"
case brendan = "Brendan"

Keybase proof

I hereby claim:

  • I am eliperkins on github.
  • I am eliperkins (https://keybase.io/eliperkins) on keybase.
  • I have a public key whose fingerprint is 9366 A899 5661 5641 D9F3 4624 99EA EEFE A3AA 2D9A

To claim this, I am signing this object:

@eliperkins
eliperkins / AorBandC.swift
Created May 17, 2016 15:26
(A || B) && C
import RxSwift
let A = Observable.just(())
let B = Observable.just(())
let C = Observable.just(())
let AorB = Observable.combineLatest(A, B) { (a, b) in
return ()
}
protocol Able {
init?(foo: String)
}
protocol Ible {
init(bar: Int) throws
}
extension Able where Self: Ible {
init?(foo: String) {

Apple TV Tech Talks

tvOS Fundamentals

  • Living Room experience
  • Always connected
  • Powerful hardware
  • Separate SDK with optional Universal Purchase
  • Developer tools and tech

Designing for tvOS

// Given that a protocol unifies two types: BlogPost and PhotoPost...
protocol PostType {
var title: String { get }
}
struct BlogPost: PostType {
let title = "My Hot New Blog Post"
}
struct PhotoPost: PostType {
//: Mocks Playground
import UIKit
struct User {
}
struct PushNotificationController {
let registrar: PushNotificationRegistrar
init(registrar: PushNotificationRegistrar) {