Skip to content

Instantly share code, notes, and snippets.

Christopher Bowns cbowns

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 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 / cgfloat-64-bit-macros.h
Last active Aug 29, 2015 — forked from samdmarshall/gist:6891174
A collection of macros for supporting mathematic functions on both 32- and 64-bit systems.
View cgfloat-64-bit-macros.h
#pragma mark -
#pragma mark CGFloat
#pragma mark Trigonometric Functions
#define CGFloatCos(a) (CGFLOAT_IS_DOUBLE ? cos(a) : cosf(a))
#define CGFloatSin(a) (CGFLOAT_IS_DOUBLE ? sin(a) : sinf(a))
#define CGFloatTan(a) (CGFLOAT_IS_DOUBLE ? tan(a) : tanf(a))
#define CGFloatACos(a) (CGFLOAT_IS_DOUBLE ? acos(a) : acosf(a))
#define CGFloatASin(a) (CGFLOAT_IS_DOUBLE ? asin(a) : asinf(a))
#define CGFloatATan(a) (CGFLOAT_IS_DOUBLE ? atan(a) : atanf(a))
@cbowns
cbowns / .gitconfig
Created Jul 23, 2014
A snippet of .gitconfig
View .gitconfig
# From my .gitconfig.
# Every time I use these, people get jealous.
[alias]
staged = diff --cached
unstaged = diff
list-staged = diff --staged --name-only
list-unstaged = diff --name-only
addp = add --patch
addi = add --interactive
amend = commit --amend --verbose
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:

@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
You can’t perform that action at this time.