Skip to content

Instantly share code, notes, and snippets.

View seanwolter's full-sized avatar

Sean Wolter seanwolter

View GitHub Profile
@seanwolter
seanwolter / gist:5246286
Last active December 15, 2015 10:29
git stuff I always forget
-------clone a project locally
git clone --recursive git@github.com:seanwolter/the_project_goes_here.git
-------push back to github:
git push origin master
-------add upstream to my repo
git remote add upstream git@github.com:vokalinteractive/the_project_goes_here.git
-------get back to an older commit
@seanwolter
seanwolter / enumerateSubviewsAndStealImages.m
Created April 4, 2013 18:37
enumerateSubviewsAndStealImages
- (void)enumerate:(UIView *)view withLibrary:(ALAssetsLibrary *)library
{
[[view subviews] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
if ([obj isKindOfClass:NSClassFromString(@"PLCameraToggleButton")]) {
NSLog(@"wut");
UIImage *img = [obj imageForState:UIControlStateNormal];
if (img) {
[library saveImage:img
toAlbum:@"image for state"
withCompletionBlock:^(NSError *error) {
- (void)setupDecimalPadDone
{
self.keyboardShownObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillShowNotification
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note) {
self.goButton = [UIButton buttonWithType:UIButtonTypeCustom];
[[[[UIApplication sharedApplication] windows] lastObject] addSubview:self.goButton];
@seanwolter
seanwolter / gist:8445515
Created January 15, 2014 21:54
retain return value from invocation
NSString *selectorString = [NSString stringWithFormat:@"cellForSection%dRow%d:",indexPath.section,indexPath.row];
SEL cellSelector = NSSelectorFromString(selectorString);
if ([self respondsToSelector:cellSelector]) {
NSInvocation * invocation = [ NSInvocation new ];
NSMethodSignature *signature;
CFTypeRef result = NULL;
signature = [self.class instanceMethodSignatureForSelector:cellSelector];
invocation = [NSInvocation invocationWithMethodSignature:signature];
NSString *htmlString = @"<h1>Header</h1><h2>Subheader</h2><p>Some <em>text</em></p><img src='http://blogs.babble.com/famecrawler/files/2010/11/mickey_mouse-1097.jpg' width=70 height=100 />";
NSData *data = [htmlString dataUsingEncoding:NSUnicodeStringEncoding];
NSDictionary *attributes = @{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType };
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:data options:attributes documentAttributes:nil error:nil];
textView.attributedText = attributedString;
@seanwolter
seanwolter / README.md
Last active January 4, 2017 15:42
Scripts we use on our Xcode Bots CI server

The following plists and scripts are used on VOKAL's iOS build server. Thanks to the magic of launchd the backup script runs once a day and the dropoff script runs as needed. The dropoff script imports p12 files to the system keychain and moves provisioning files to correct folder.

To use these scripts put them somewhere safe, then put the plist files in /Library/LaunchDaemons Update the paths to the scripts, fix the ACCESS_KEY_ID and SECRET_ACCESS_KEY variables, and you're on your way.

If you have questions about Daemons and Agents look at Apple's technote: https://developer.apple.com/library/mac/technotes/tn2083/_index.html

More docs: https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/Introduction.html#//apple_ref/doc/uid/10000172i-SW1-SW1