Skip to content

Instantly share code, notes, and snippets.

View cbowns's full-sized avatar

Christopher Bowns cbowns

View GitHub Profile
/**
A custom destination to log SwiftyBeaver calls through to Bugfender.
Via http://support.bugfender.com/supported-logging-frameworks/swiftybeaver-support
*/
import Foundation
import SwiftyBeaver
import BugfenderSDK
public class BugfenderDestination: BaseDestination {
@cbowns
cbowns / craziness.sh
Created August 16, 2017 00:45
Rename your iOS archives to include the app's version and build number
# Pardon the craziness:
# Given a directory of `*.xcarchive`s:
# enter your app's name for "<App name>", if you have a folder of
# heterogenous archives to process:
for dir (*); do
name=`defaults read "\`pwd\`"/$dir/Info.plist Name`
if [ "$name" = "<App name>" ];
then

Keybase proof

I hereby claim:

  • I am cbowns on github.
  • I am cbowns (https://keybase.io/cbowns) on keybase.
  • I have a public key ASDcgZLnH6jzgmU6mfcdi-XdWF1Z_qb2RLISud2ga7roUwo

To claim this, I am signing this object:

// When calling `init()`, iOS 8 doesn't load our xib. Make sure we do.
// http://stackoverflow.com/a/25152545/774)
convenience init() {
let className = String(self.dynamicType).componentsSeparatedByString(".").last
self.init(nibName: className, bundle: nil)
}
do {
try <#throwing method#>
} catch let error as NSError {
let errorString = "<#describe the error#>"
DDLogError("Error: \(errorString)")
DDLogError(error.debugDescription)
assert(false, errorString)
}
@cbowns
cbowns / gist:7359383
Created November 7, 2013 18:21
Broken ssh key on OS X 10.9 Mavericks
% ssh-keygen -vvv -y -f id_rsa.converted
debug3: Incorrect RSA1 identifier
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase:
debug3: Incorrect RSA1 identifier
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
load failed
@cbowns
cbowns / xcode.sh
Last active December 26, 2015 04:19
A shell function for opening an Xcode workspace or project in the current directory or in a directory passed as a parameter.To open Project.xcodeproj or Project.xcworkspace:`cd Project; xcode`. Alternately, `xcode Project/`.
# Base function:
# Takes two arguments: a directory and a name for Xcode.
function open_with_xcode {
targetDirectory=$1
xcodeApp=$2
# If there's a workspace file, open that.
didFindXCWorkspace=`find $targetDirectory -depth 1 | grep -i .xcworkspace | wc -l | sed -e 's/^ *//g' -e 's/ *$//g'`
# Testing a glob with -d, like
# if [ -d *.xcworkspace ];
// Copyright (c) 2012-2013 Peter Steinberger (http://petersteinberger.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
@cbowns
cbowns / gist:6056535
Created July 22, 2013 18:57
A model object with a BOOL property backed by an NSNumber in the implementation
// An example of a model object with a boolean property
// that's backed by an NSNumber from a JSON response
@interface ModelObject : NSObject
@property (nonatomic, assign, getter = isEnabled) BOOL enabled;
@end
@interface ModelObject ()
@cbowns
cbowns / gist:5289226
Created April 2, 2013 01:25
Serializing an image's contents in the iOS Simulator
# In the debugger:
# (fill in <home> and <image> below with your user path and the image's ivar
p (BOOL)[(NSFileManager *)[NSFileManager defaultManager] createFileAtPath:@"<home>/Desktop/image.png" contents:(void *)UIImagePNGRepresentation(<image>) attributes:nil]