Skip to content

Instantly share code, notes, and snippets.

View gdavis's full-sized avatar

Grant Davis gdavis

View GitHub Profile
@gdavis
gdavis / .gitignore
Created February 24, 2014 16:23 — forked from adamgit/.gitignore
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# Version 2.0
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
#
# NB: if you are storing "built" products, this WILL NOT WORK,
@gdavis
gdavis / .gitignore
Last active August 29, 2015 14:02 — forked from adamgit/.gitignore
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# Version 2.0
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
#
# NB: if you are storing "built" products, this WILL NOT WORK,
@gdavis
gdavis / GDILog.h
Last active August 29, 2015 14:05
GDILog - Replacement for NSLog
//
// GDILog.h
// GDILog
//
// Created by Grant Davis on 8/18/14.
// Copyright (c) 2014 Grant Davis Interactive, LLC. All rights reserved.
//
#ifdef DEBUG
#include <string.h>
@gdavis
gdavis / gist:2353296
Created April 10, 2012 18:04
XCode Project Build Number Auto Increment Script
# Auto Increment Version Script
# This script will increment the build number by 1
# when running a configuration other than Debug and Release
# while not on intel architecture
arch=${ARCHS:0:4}
conf=${CONFIGURATION}
if [ "$conf" != "Debug" ] && [ "$conf" != "Release" ] && [ "$arch" != "i386" ]
then
buildPlist=${INFOPLIST_FILE}
buildVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $buildPlist)
@gdavis
gdavis / gist:2837065
Created May 30, 2012 15:39
Turn off ARC for a specific file
In Xcode, go to the target for the app, Build Phases, and find the file you want to have ARC ignore in Compile Sources. Double-click the file, and in the popup add this compiler flag:
-fno-objc-arc
And when you compile Xcode will turn off ARC! Yay!
@gdavis
gdavis / gist:2918964
Created June 12, 2012 17:41
How to use Static Libraries under Xcode 4
Create a Workspace
Under Xcode 4, go to File, New, Workspace.
From Finder you can then drag in the .xcodeproj projects for both the static library you want to use, and the new app you are building that uses the library. See Apple Docs for more info on setting up Workspaces: http://developer.apple.com/library/ios/#featuredarticles/XcodeConcepts/Concept-Workspace.html
Static Library Project Settings
Make sure all the static library's headers are set to copy to "Public". This is done under the settings for the static library target > Build Phases. In the "Copy Headers" phase, make sure all your headers are within the "Public" section.
Next go to Build Settings, find "Public Headers Folder Path" and type in a path for your library. I choose to use this:
include/LibraryName
I've adopted this from use with RestKit and found it works best with all my static libraries. What this does is tells Xcode to copy all the headers we moved to the "Public" headers section in step 1 to the folder we specify here which resides
@gdavis
gdavis / gist:3056737
Created July 5, 2012 21:55
Edit crontab in nano
EDITOR=/usr/bin/nano crontab -e
@gdavis
gdavis / gist:3813665
Created October 1, 2012 18:46
Display popover for textfield
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
// prevent the start date from manually entering text.
// instead, we display a popover with a date picker
if (textField == self.startDateField && self.popover == nil) {
[self.view endEditing:NO];
[self presentDatePickerFromField:textField pickerID:nil];
return NO;
}
@gdavis
gdavis / gist:4204762
Created December 4, 2012 14:54
Precompile Rails assets:
bundle exec rake assets:precompile
@gdavis
gdavis / gist:4464349
Created January 5, 2013 23:46
Launch postgres db application
postgres -D /usr/local/var/postgres