Skip to content

Instantly share code, notes, and snippets.

View pxpgraphics's full-sized avatar

Paris Xavier Pinkney pxpgraphics

View GitHub Profile
@pxpgraphics
pxpgraphics / xcode-build-bump.sh
Created November 26, 2015 21:41 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
// MARK: PXPAssert
/**
Traditional C-style assert with an optional message.
Use this function for internal sanity checks that are active
during testing but do not impact performance of shipping code.
* In playgrounds and -Onone builds (the default for Xcode's Debug
configuration): if `condition` evaluates to false, stop program
// MARK: PXPLog
/**
Traditional C-style log with an optional message.
Prints file, line and function, by default, followed the messaage, if applicable.
- parameter file: The name of the file; defaults to the current localized file.
- parameter function: The name of the function; defaults to the function within which the call is made.
- parameter line: The line number; defaults to the line number within the file that the call is made.
*/
@transparent
extension RawRepresentable where RawValue == String {
var description: String {
return rawValue
}
}
extension RawRepresentable where RawValue: CustomStringConvertible {
var description: String {
return rawValue.description
}
@pxpgraphics
pxpgraphics / StickyHeadersCollectionViewFlowLayout.m
Created January 15, 2016 18:38 — forked from randomsequence/StickyHeadersCollectionViewFlowLayout.m
A subclass of UICollectionViewFlowLayout which has UITableView style sticky headers.
// StickyHeadersCollectionViewFlowLayout
//
// A subclass of UICollectionViewFlowLayout which has UITableView style sticky headers.
//
// This code is based on Evadne Wu's code^1, with the following changes:
//
// * Fixes a crash for sections with zero items
// * Adds support for UIScrollView's contentInset
// * Adds support for UICollectionViewFlowLayout's sectionInset
//
- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity
{
CGFloat offSetAdjustment = MAXFLOAT;
CGFloat horizontalCenter = (CGFloat) (proposedContentOffset.x + (self.collectionView.bounds.size.width / 2.0));
CGRect targetRect = CGRectMake(proposedContentOffset.x, 0.0, self.collectionView.bounds.size.width, self.collectionView.bounds.size.height);
NSArray *array = [self layoutAttributesForElementsInRect:targetRect];
for (UICollectionViewLayoutAttributes *layoutAttributes in array)
{
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
@pxpgraphics
pxpgraphics / universal-framework.sh
Created August 24, 2016 00:22 — forked from cromandini/universal-framework.sh
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures).
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
@pxpgraphics
pxpgraphics / gist:3bee670bb7108e8ce79e5440b77e11bb
Created September 22, 2016 19:02 — forked from steipete/gist:6133152
Create a hash from a CGRect
NSUInteger PSPDFHashFromCGRect(CGRect rect) {
return (*(NSUInteger *)&rect.origin.x << 10 ^ *(NSUInteger *)&rect.origin.y) + (*(NSUInteger *)&rect.size.width << 10 ^ *(NSUInteger *)&rect.size.height);
}
@pxpgraphics
pxpgraphics / _verify-repair-permissions-disk.md
Created November 26, 2016 03:34 — forked from bzerangue/_verify-repair-permissions-disk.md
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /