Skip to content

Instantly share code, notes, and snippets.

View fictorial's full-sized avatar

Brian Hammond fictorial

View GitHub Profile
@fictorial
fictorial / ContactsLoader.h
Last active August 29, 2015 14:03
Trying to get Facebook social profile from AddressBook
@interface LocalContact : NSObject
@property (nonatomic, copy) NSString *firstName;
@property (nonatomic, copy) NSString *lastName;
@property (nonatomic, copy, readonly) NSString *fullName;
@property (nonatomic, copy) NSString *mobileNumber;
@property (nonatomic, copy) NSString *normalizedMobileNumber;
@property (nonatomic, copy) NSString *facebookID;
Thanks guys, with a little help from a friend I ended up fixing it by
setting on the pods project "Build active architechtures only" to no. and
then the standard architechtures for both the targets and the project.
Hope this helps someone.
static inline void dispatchOncePersistent(NSString *prefsKey, void (^aBlock)())
{
if (![[NSUserDefaults standardUserDefaults] boolForKey:prefsKey]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:prefsKey];
[[NSUserDefaults standardUserDefaults] synchronize];
aBlock();
}
}
@fictorial
fictorial / YAHTZEE.BAS
Created October 10, 2012 16:37
YAHTZEE.BAS
'--------------------------
' Yahtzee Version 1.1
' Brian Hammond
' Finished: June 25, 1995
' Coded in: MS-QBasic 7.1
'--------------------------
'Initial Setup-------------------------------------------------------------
'make arrays static by usage of a MetaCommand (needs the comment)
@fictorial
fictorial / gist:3248414
Created August 3, 2012 15:00
dismiss keyboard from anywhere
[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];
@fictorial
fictorial / generate-cocoapods-summary.sh
Created May 23, 2012 03:56
Generate description of all CocoaPods specs from HEAD
#!/bin/sh
# 1. install multimarkdown
# 2. clone the CocoaPods/Specs repo to ~/OpenSource/Specs
cd ~/OpenSource/Specs
git pull
file=~/Desktop/cocoapods-specs.html
@fictorial
fictorial / CCScreenshot.h
Created May 15, 2012 04:45
cocos2d-iphone screenshots
#import "cocos2d.h"
@interface CCScreenshot: NSObject
+ (NSString *)screenshotPathForFile:(NSString *)file;
+ (CCRenderTexture *)screenshotWithStartNode:(CCNode*)startNode filename:(NSString*)filename;
@end
@fictorial
fictorial / CCLayerPanZoomTestLayer.m
Created May 9, 2012 20:21
CCLayerPanZoom double-tap to zoom in/out with zoom-towards-point like in the Maps app
- (void) layerPanZoom: (CCLayerPanZoom *) sender
clickedAtPoint: (CGPoint) point
tapCount: (NSUInteger) tapCount
{
NSLog(@"CCLayerPanZoomTestLayer#layerPanZoom: %@ clickedAtPoint: { %f, %f }", sender, point.x, point.y);
if (tapCount == 2) {
// Toggle zooming all the way in and all the way out.
float midScale = (sender.minScale + sender.maxScale) / 2.0;
@fictorial
fictorial / problem1.c
Created February 11, 2012 07:36
embedly challenge
/* Problem 1
*
* See http://apply.embed.ly/1
*
* The trick here is to realize that primitive types will overflow very quickly.
* This problem gave me a nice excuse to learn libgmp.
*
* On Mac OS X,
* $ brew install gmp
* $ gcc problem1.c && ./a.out
@fictorial
fictorial / Xcode4TestFlightintegration.sh
Created November 10, 2011 05:32 — forked from incanus/Xcode4TestFlightintegration.sh
Xcode 4 scheme Archive step Post-script for automatic TestFlight build uploading. See the blog post here: http://developmentseed.org/blog/2011/sep/02/automating-development-uploads-testflight-xcode
# https://testflightapp.com/account/
API_TOKEN=XXX
# https://testflightapp.com/dashboard/team/edit/
TEAM_TOKEN=XXX
# Whatever you use for Adhoc
SIGNING_IDENTITY="iPhone Distribution: XXX"
# Organizer > Devices > Provisioning Profiles > Ad Hoc then Reveal in Finder