Skip to content

Instantly share code, notes, and snippets.

View octover's full-sized avatar

Caleb Jaffa octover

View GitHub Profile
@octover
octover / carthage_workaround.rb
Created July 18, 2019 08:50
Xcode 11 Beta 4 Carthage workaround
#!/usr/bin/env ruby
require 'find'
require 'xcodeproj'
Find.find("Carthage/Checkouts/.") do |f|
if f.end_with?(".xcodeproj")
project = Xcodeproj::Project.open(f)
project.targets.each do |target|
target.build_configurations.each do |config|
@octover
octover / UIColor+Color.swift
Created July 17, 2019 10:10
UIColor to SwiftUI.Color extension
extension UIColor {
func color(with colorScheme: ColorScheme) -> Color {
var red: CGFloat = 0
var blue: CGFloat = 0
var green: CGFloat = 0
var alpha: CGFloat = 0
let trait: UITraitCollection = {
switch colorScheme {
case .light:
@octover
octover / imageNamedinBundle.m
Last active August 29, 2015 14:16
imageNamed from a specific bundle
// This isn't documented to handle @2x, but it appears to in practice
// Had to put all images in a bundle so something like this:
image = [UIImage imageNamed:@"rounded_button.png"];
// became:
NSURL *url = [[NSBundle mainBundle] URLForResource:@"BruffLiteResources" withExtension:@"bundle"];
NSBundle *bundle = [NSBundle bundleWithURL:url];
NSString *imagePath = [bundle pathForResource:@"share" ofType:@"png"];
image = [UIImage imageWithContentsOfFile:imagePath];

Keybase proof

I hereby claim:

  • I am octover on github.
  • I am octover (https://keybase.io/octover) on keybase.
  • I have a public key whose fingerprint is 5480 1D5F 5045 98F9 E229 CC43 D58D EA34 BA02 B7BB

To claim this, I am signing this object:

@octover
octover / gist:145611
Created July 12, 2009 11:48
iPhone System Button Image Data
// save the info system button image to where you can access it, this should be able to
// go anywhere it gets run by an iPhone program, easiest if you do it with the simulator
UIButton *info = [UIButton buttonWithType:UIButtonTypeInfoLight];
NSData *img = UIImagePNGRepresentation([info imageForState:UIControlStateNormal]);
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"info.png"];
[img writeToFile:path atomically:NO];
NSLog(@"%@", path);