Skip to content

Instantly share code, notes, and snippets.

Sean Henry seanhenry

  • London
Block or report user

Report or block seanhenry

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@seanhenry
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
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)
end
def lineCountsFromString(string)
lineCountsStrings = string.split("\n")
@seanhenry
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
view.layoutIfNeeded()
@seanhenry
seanhenry / Gemfile
Last active Nov 29, 2017
Source: Better network debugging with Charles Proxy and iOS. See original post for explanation http://seanhenry.codes/ios/better-network-debugging-charles-proxy-ios/
View Gemfile
source 'https://rubygems.org' do
gem 'sinatra'
end
@seanhenry
seanhenry / resign.sh
Created May 1, 2018
Changes provisioning profile, bundle ID, and resigns prebuilt iOS .ipa (Last tested Xcode 9.3)
View resign.sh
APPNAME=YourAppName # not including .app/.ipa suffix
BUILDNUMBER=300 # change build number to this value
CERTIFICATE="iPhone Distribution: Your Organisation name here (8JSK92JDKSM)"
PROFILE="NewProvisioningProfile.mobileprovision"
BUNDLE_ID="BundleID"
cp "${APPNAME}.ipa" "${APPNAME}.zip"
mkdir contents || true
unzip "${APPNAME}.zip" -d contents
codesign -d --entitlements :Entitlements.plist "contents/Payload/${APPNAME}.app"
@seanhenry
seanhenry / resign.sh
Last active Aug 26, 2019
Resign an ipa and change the build number
View resign.sh
APPNAME=App
BUILDNUMBER=123
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"
You can’t perform that action at this time.