Skip to content

Instantly share code, notes, and snippets.

View seanwolter's full-sized avatar

Sean Wolter seanwolter

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

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 / 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];
- (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 / 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) {
@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
NSMutableArray *objects = [@[] mutableCopy];
NSObject *someObject = [NSObject new];
objects[objects.count] = object;
@seanwolter
seanwolter / gist:5214606
Last active December 15, 2015 06:09
set a button's background image in interface builder then stretch it in code
- (void)awakeFromNib
{
[self strechImageForControlState:UIControlStateNormal];
[self strechImageForControlState:UIControlStateDisabled];
[self strechImageForControlState:UIControlStateHighlighted];
[self strechImageForControlState:UIControlStateSelected];
}
- (void)strechImageForControlState:(UIControlState)controlState
{
/*
* SenTestingKit does not wait for blocks to finish by default so your test would simply complete
* as successful. You need to use a semaphore and keep the run loop going in order for the test
* to properly run.
*/
- (void)testGetSpots {
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
CLLocation location = [[CLLocation alloc] initWithLatitude:70.0 longitude:50.0];
[Spot spotsWithURLString:@"/spots" near:location parameters:[NSDictionary dictionaryWithObject:@"128" forKey:@"per_page"] block:^(NSArray *records) {
//sample assert