Skip to content

Instantly share code, notes, and snippets.

View soffes's full-sized avatar

Sam Soffes soffes

View GitHub Profile
@soffes
soffes / Rakefile
Last active January 18, 2026 18:52
Programmatically build and sign a Developer ID macOS app
TEAM_ID = 'XXXXXXXXXX'
APP_NAME = 'My App'
SCHEME_NAME = APP_NAME
desc 'Create a beta build'
task :build do
# Ensure clean git state
unless system 'git diff-index --quiet HEAD --'
abort 'Failed. You have uncommitted changes.'
end

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";
@soffes
soffes / convert-music.rb
Last active August 31, 2025 18:16
Convert audio files on an external hard drive into MP3 format on my desktop
require "fileutils"
require "open3"
require "pathname"
require "progressbar"
input_directory = "/Volumes/Artemis/Music"
output_directory = "/Users/soffes/Desktop/Music"
extensions = %w[wav aiff mp3 m4a]
target_extension = "mp3"
@soffes
soffes / Example.swift
Last active July 25, 2025 12:40
KeyboardLayoutGuide
override func viewDidLoad() {
super.viewDidLoad()
let keyboardGuide = KeyboardLayoutGuide()
view.addLayoutGuide(keyboardGuide)
NSLayoutConstraint.activate([
someTextField.bottomAnchor.constraint(lessThanOrEqualTo: view.safeAreaLayoutGuide.bottom, constant: -8),
someTextField.bottomAnchor.constraint(lessThanOrEqualTo: keyboardGuide.topAnchor, constant: -8),
])
@soffes
soffes / install.markdown
Last active June 9, 2025 07:18
New computer setup

New Machine

Updated this for the first time in awhile in late 2020.

System Preferences

  • Enable iCloud
  • Disable iCloud mail
  • Display to medium
  • Turn up trackpad speed
@soffes
soffes / README.md
Last active June 5, 2025 15:05
Open snapshot diffs in Kaleidoscope

Apparently, SnapshotTesting has this built-in. 🤦


While working with snapshot tests, it can be hard to debug what the problem is. This script allows you to quickly open the diff in a visual tool, Kaleidoscope, to compare the visual changes.

The output of SnapshotTesting when a snapshot doesn’t match looks like this:

@−
@soffes
soffes / Podfile
Created May 13, 2013 15:46
Seesaw Podfile
platform :ios, '5.0'
# Awesome networking
pod 'AFNetworking'
# Backported UICollectionView
pod 'PSTCollectionView'
# Rich text
pod 'TTTAttributedLabel'
#!/bin/sh
# Install ImageMagick on Snow Leopard: by kain, improved by mislav and samsoffes
# http://www.icoretech.org/2009/08/install-imagemagick-in-leopard-snow-leopard/
# Work with 64bit kernel mode
set -e
PREFIX=/usr/local
# Passenger users: amend your Apache global configuration with the following directive
# SetEnv PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
@soffes
soffes / CLLocationCoordinate2D+Equatable.swift
Last active September 11, 2024 14:15
Add Equatable to CLLocationCoordinate2D
import CoreLocation
extension CLLocationCoordinate2D: Equatable {}
public func ==(lhs: CLLocationCoordinate2D, rhs: CLLocationCoordinate2D) -> Bool {
return lhs.latitude == rhs.latitude && lhs.longitude == rhs.longitude
}
@soffes
soffes / GPUImageTextureInput+CIImage.h
Last active July 7, 2024 08:51
GPUImage + Core Image
//
// GPUImageTextureInput+CIImage.h
// GPUImage
//
// Created by Sam Soffes on 3/4/14.
// Copyright (c) 2014 Sam Soffes. All rights reserved.
//
#import "GPUImageTextureInput.h"