Skip to content

Instantly share code, notes, and snippets.

View fictorial's full-sized avatar

Brian Hammond fictorial

View GitHub Profile
@fictorial
fictorial / acks_acks.txt
Created October 31, 2014 12:52
Please do not ACK my ACKs!
Please do not ACK my ACKs!
I already have stacks and stacks!
If you would be so kind, offer me some pork rind.
You see, I prefer snacks, not ACKs!
I have a yak. His name is Jack.
And when he walks, Jack makes tracks.
I follow his tracks to stacks of snacks.
But when you ACK my ACKs, all I see are stacks of ACKs.
I cannot see Jack's yak tracks!
@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