Skip to content

Instantly share code, notes, and snippets.

Michael Behan mbehan

Block or report user

Report or block mbehan

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
@mbehan
mbehan / ComplicationLaunchSnippets.swift
Created Oct 18, 2016
Sample code demonstrating how to determine which complication family was tapped to launch your watchOS app
View ComplicationLaunchSnippets.swift
// 1.
class ComplicationTimeKeeper{
static let shared = ComplicationTimeKeeper()
var utilitarianLarge : Date?
var utilitarianSmall : Date?
var circularSmall : Date?
var modularLarge : Date?
var modularSmall : Date?
@mbehan
mbehan / ForcePanGestureRecognizer.swift
Created Nov 11, 2016
A UIPanGestureRecognizer subclass to get the force of the gesture's touch (assumes a single touch)
View ForcePanGestureRecognizer.swift
import UIKit.UIGestureRecognizerSubclass
class ForcePanGestureRecognizer : UIPanGestureRecognizer {
private(set) var force = CGFloat(0) {
didSet {
if force > maxForce {
maxForce = force
}
}
@mbehan
mbehan / ElementaryCellularAutomata.swift
Created Dec 4, 2018
Swift playground for outputting elementary cellular automata
View ElementaryCellularAutomata.swift
import Foundation
extension Bool {
init(_ char: Character) {
self = String(char).boolValue
}
}
extension String {
func character(at index: Int) -> Character {
View SwiftyButton.swift
extension UIControl.Event: Hashable{
public var hashValue: Int{
return Int(self.rawValue)
}
static func == (lhs: UIControl.Event, rhs: UIControl.Event) -> Bool{
return lhs.rawValue == rhs.rawValue
}
}
View keybase.md

Keybase proof

I hereby claim:

  • I am mbehan on github.
  • I am michaelbehan (https://keybase.io/michaelbehan) on keybase.
  • I have a public key ASDdJfRf5elbvh7OeiCeKP54WC_DOrPPvDrRsusfFU1iSAo

To claim this, I am signing this object:

@mbehan
mbehan / build-uploader.sh
Last active May 19, 2016
Uploads builds produced by Xcode bots
View build-uploader.sh
#!/bin/bash
files=/ci_scripts/*.plist
for f in $files
do
echo Processing $f "..."
productName="$(/usr/libexec/plistbuddy -c Print:ProductName: "$f")"
echo $productName
@mbehan
mbehan / increment-build-number.sh
Created Apr 23, 2014
Add as a pre compile build phase in Xcode to auto increment your build number (bundle version). Format is revHash.user.number
View increment-build-number.sh
last_commit=$(git rev-parse --short HEAD)$([[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && echo "*")
CFBundleVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNum=${CFBundleVersion##*.}
buildNum=$((buildNum + 1))
CFBundleVersion=$last_commit"."$USER"."buildNum
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CFBundleVersion" "$INFOPLIST_FILE"
You can’t perform that action at this time.