Skip to content

Instantly share code, notes, and snippets.

View seanwolter's full-sized avatar

Sean Wolter seanwolter

View GitHub Profile
@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

@seanwolter
seanwolter / gist:d5b17fb5f6019b04b763
Last active August 29, 2015 14:22
how Vokal's iOS team evaluates candidates
At Vokal our engineering interview process is pretty simple. Before we get emotionally attached
to any candidate we meet with them for two coding challenges. Candidates solve these contrived
coding conundrums with members of our team. During the challenge candidates are encouraged to
check documentation, google for help, and talk to their proctor. The exercise is not about
brain teasers, but how candidates work with people to solve a novel problem. Most of our
challenges require manipulating basic data structures. The work is completed in a collaborative
text editor. Often the most difficult part for candidates is working without autocomplete.
We've often asked ourselves what we want from candidates in these programming exercises. In short,
we're trying our best to notice the idiosyncrasies of a good engineer. There are small things like,