Skip to content

Instantly share code, notes, and snippets.

Christopher Bowns cbowns

Block or report user

Report or block cbowns

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
View BugfenderDestination.swift
/**
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 Aug 16, 2017
Rename your iOS archives to include the app's version and build number
View craziness.sh
# 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
View keybase.md

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:

View iOS8LoadXIBViewController.swift
// 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)
}
View Swift 2.2 error-handling
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 Nov 7, 2013
Broken ssh key on OS X 10.9 Mavericks
View gist:7359383
% 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 Dec 26, 2015
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/`.
View xcode.sh
# 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 ];
View PSPDFKitImproveRecursiveDescription.m
// 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 Jul 22, 2013
A model object with a BOOL property backed by an NSNumber in the implementation
View gist:6056535
// 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 Apr 2, 2013
Serializing an image's contents in the iOS Simulator
View gist:5289226
# 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]
You can’t perform that action at this time.