This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[@3 times:^{ | |
NSLog(@"Hello World!"); | |
}]; | |
// Hello World! | |
// Hello World! | |
// Hello World! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
fDebugger = [PDDebugger defaultInstance]; | |
[fDebugger enableNetworkTrafficDebugging]; | |
[fDebugger forwardAllNetworkTraffic]; | |
[fDebugger enableCoreDataDebugging]; | |
[fDebugger addManagedObjectContext:self.managedObjectContext withName:@"Popular on 500px"]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> git clone git://github.com/stevenhuey/UICollectionViewExample.git | |
> cd UICollectionViewExample | |
> mkdir Frameworks | |
> git submodule add -f git://github.com/square/PonyDebugger.git Frameworks/PonyDebugger | |
> git submodule update --init --recursive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/stevenhuey/SuperDebuggerDemo.git | |
cd SuperDebuggerDemo | |
git submodule update --init --recursive | |
open Frameworks/superdb/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given a page use the Nokogiri gem to find all the HREFs (links) on the page | |
require 'nokogiri' | |
require 'open-uri' | |
def getAllHrefsInPage(page) | |
doc = Nokogiri::HTML(open(page)) | |
links = doc.css('a') | |
hrefs = links.map {|link| link.attribute('href').to_s}.uniq.sort.delete_if {|href| href.empty?} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Instead of writing | |
STAssertEqualObjects(@"foo", @"foo", @"Expected 'foo', but was...."); | |
// With Expecta we can write | |
expect(@"foo").to.equal(@"foo); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)willSendResponse:(BARResponse*)response | |
forRequest:(BARRequest*)request | |
forConnection:(BARConnection*)connection | |
continueHandler:(void (^)(void))handler | |
{ | |
NSString* viewName = [response customValueForKey:@"BARTemplateView"]; | |
if (viewName) | |
{ | |
NSURL *viewURL = [[self.viewsDirectoryURL URLByAppendingPathComponent:viewName] URLByAppendingPathExtension:[[self class] templateFileExtension]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)runWithURL:(NSURL*)serverRoot onPort:(NSUInteger)port | |
{ | |
_server = [BARServer serverWithPort:port]; | |
[_server addGlobalMiddleware:[MarkdownTemplateRenderer rendererWithViewsDirectoryURL:serverRoot]]; | |
BARRouter *router = [[BARRouter alloc] init]; | |
[_server addGlobalMiddleware:router]; | |
[router addRoute:@"/:view" forHTTPMethod:@"GET" handler:^BOOL(BARConnection *connection, BARRequest *request, NSDictionary *parameters) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)indexAirportData | |
{ | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ | |
for (ALAirport* airport in self.airports) | |
{ | |
// Create the attribute set | |
CSSearchableItemAttributeSet* attributeSet = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString*)kUTTypeItem]; | |
attributeSet.displayName = airport.airportName; | |
attributeSet.latitude = @(airport.coordinate.latitude); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)searchFor:(NSString*)query | |
{ | |
// Cancel any existing search queries | |
if (self.searchQuery) | |
{ | |
[self.searchQuery cancel]; | |
self.searchQuery = nil; | |
[self.searchResults removeAllObjects]; | |
[self updateSearchResults]; | |
} |