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 / Spacegray.dvtcolortheme
Created January 7, 2014 16:53
Spacegray color theme for Xcode
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0.7653 0.699234 0.758969 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 13.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0.6431 0.5881 0.637824 1</string>

Implementing a Strong Code-Review Culture

As an author

  • Provide more/sufficient context around changes
  • Linking to the issue isn't always enough
  • Challenge: 2 paragraphs of context

As a reviewer

  • Offer compliments in PRs when you learn or something is done well
  • Ask questions rather than make demands/commands, engage in conversation
//: Mocks Playground
import UIKit
struct User {
}
struct PushNotificationController {
let registrar: PushNotificationRegistrar
init(registrar: PushNotificationRegistrar) {
@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 / UISearchBar+RACAdditions.m
Created March 18, 2014 18:07
ReactiveCocoa UISearchBar additions
//
// Created by Eli Perkins on 3/18/14.
// Copyright (c) 2014 One Mighty Roar. All rights reserved.
//
#import <objc/runtime.h>
#import "UISearchBar+RACAdditions.h"
#import "NSObject+RACDescription.h"
#import "RACDelegateProxy.h"
@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 ()
}