Skip to content

Instantly share code, notes, and snippets.

seanhenry /
Created May 1, 2018
Changes provisioning profile, bundle ID, and resigns prebuilt iOS .ipa (Last tested Xcode 9.3)
APPNAME=YourAppName # not including .app/.ipa suffix
BUILDNUMBER=300 # change build number to this value
CERTIFICATE="iPhone Distribution: Your Organisation name here (8JSK92JDKSM)"
cp "${APPNAME}.ipa" "${APPNAME}.zip"
mkdir contents || true
unzip "${APPNAME}.zip" -d contents
codesign -d --entitlements :Entitlements.plist "contents/Payload/${APPNAME}.app"
seanhenry / Gemfile
Last active Feb 19, 2022
Source: Better network debugging with Charles Proxy and iOS. See original post for explanation
View Gemfile
source '' do
gem 'sinatra'
seanhenry / Playground.swift
Last active Nov 27, 2017
SO: Out of bounds UIView constraints programmatically
View Playground.swift
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
let vc = UIViewController()
let view = vc.view!
PlaygroundPage.current.liveView = vc
seanhenry /
Last active Apr 12, 2022
Resign an ipa and change the build number
CERTIFICATE="iPhone Distribution"
cp "${APPNAME}.ipa" "${APPNAME}.zip"
mkdir contents || true
unzip "${APPNAME}.zip" -d contents
codesign -d --entitlements :Entitlements.plist "contents/Payload/${APPNAME}.app"
plutil -replace CFBundleVersion -string "${BUILDNUMBER}" "contents/Payload/${APPNAME}.app/Info.plist"
rm -r "contents/Payload/${APPNAME}.app/_CodeSignature"
seanhenry / SRPAnalyser.rb
Created Nov 6, 2015
A script to search Objective-C and Swift files which outputs the number of lines in each file. I've used this to determine areas of an application which violate the Single Responsibility Principle. Output quickly identifies the largest classes in a project.
View SRPAnalyser.rb
# Dependencies: sudo gem install colorize
# Usage: ruby SRPAnalyser.rb --hide-acceptable <Path to search>
require 'colorize'
def displayFileWithNumberOfLines (file, lines, hideAcceptable)
message = "#{file} has #{lines} lines."
maxLines = 250
acceptableLines = 150
if lines > maxLines
seanhenry / LineCounter.rb
Last active Nov 6, 2015
A script which counts lines of code in Swift and Objective-C projects. It ignores blank lines and counts production code and test code separately. It provides the average number of lines per file and the standard deviation.
View LineCounter.rb
# Usage: ruby LineCounter.rb <directory to search>
class LineCounter
def initialize(lineCounts)
@lineCounts = lineCountsFromString(lineCounts)
def lineCountsFromString(string)
lineCountsStrings = string.split("\n")