Skip to content

Instantly share code, notes, and snippets.


Daniel Mathews dmathewwws

View GitHub Profile
View gist:a8971433dcaf014f4aef
// LHDFingerpaintView.m
// Drawing
// Created by Steven Masuch on 2014-07-31.
// Copyright (c) 2014 Lighthouse Labs. All rights reserved.
#import "LHDFingerpaintView.h"
View gist:267b8dc85709e9059135
## Week 3 Interview Questions
#### Goals
- Understand Storyboards
- Understanding basic application architecture
- Familiarity with most common Cocoa/Foundation classes & patterns (delegation, target-action)
##### Question 1
View gist:4b9ff04cffd2776ba56f
Delegation should be preferred method. For more information, see
The custom collection view cell subclass header should look similar to the following code snippet. A couple of things to look for:
It is important that the delegate callbacks include the cell (sender in the following snippet) as one of the parameters. We will need to know which cell invokes the delegate callback in order to find the index path for the cell, which we will then use to retrieve the Photo object to pass to the method to either share or report the photo.
The custom collection view cell subclass should never have or keep a reference to the photo object. Doing so would break MVC pattern where the view should never talk to the model directly.
@import UIKit;
@protocol PanoramaPhotoCollectionViewCellDelegate;
View WWDC Sessions by

WWDC Sessions by Topics

Language and Runtime

  • WWDC 2012 Session 405 — Modern Objective-C
  • WWDC 2012 Session 413 — Migration to Modern Objective-C
  • WWDC 2013 Session 228 — Hidden Gems in Cocoa and Cocoa Touch
  • WWDC 2014 Session 402 — Introduction to Swift
  • WWDC 2014 Session 403 — Intermediate Swift
  • WWDC 2014 Session 404 — Advanced Swift
View Binary Recursion
range binaryRangedSearch(int array[], int searchValue, int minimumSearchBounds,int maximumSearchBounds)
// We would perform the search much like above
// where we go to find the value. But once we've found it,
// we need to find out where it occurs first and where it occurs last.
if (minimumSearchBounds > maximumSearchBounds) {
range notFound = {-1, 0};
return notFound;
View gist:d430e8817de54f138e81
// How to create your own completion blocks
+ (void)responseFrom4sq:(CLLocation*)currentLocation limit:(NSString*)limit block:(void (^)(NSArray *locationDictionary, NSError *error))completionBlock{
NSString *apiString4aq= @"";
NSString *clientID = @"&client_id=x&client_secret=y";
NSString *version = @"&v=20121219";
NSMutableURLRequest *foursqRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%1.6f,%1.6f%@%@&limit=%@",apiString4aq,currentLocation.coordinate.latitude,currentLocation.coordinate.longitude,clientID,version,limit]]];
dispatch_queue_t foursqQueue;
dmathewwws / gist:37a18558426cea5edc84
Created Jul 11, 2015
How to limit UITableView row reordering to a section
View gist:37a18558426cea5edc84
override func tableView(tableView: UITableView, targetIndexPathForMoveFromRowAtIndexPath sourceIndexPath: NSIndexPath, toProposedIndexPath proposedDestinationIndexPath: NSIndexPath) -> NSIndexPath {
if sourceIndexPath.section != proposedDestinationIndexPath.section {
var row = 0
if sourceIndexPath.section < proposedDestinationIndexPath.section {
row = tableView.numberOfRowsInSection(sourceIndexPath.section) - 1
return NSIndexPath(forItem: row, inSection: sourceIndexPath.section)
return proposedDestinationIndexPath;
View gist:a21b30be107533369975c938981da78b
apt-get update -y
apt-get upgrade -y
apt-get install git -y
curl -fsSL | sh
apt-get install python-pip -y
pip install docker-compose
View gist:6043fb880dc31e0cde23c60d5d8ea995
# HTTP - redirect all requests to HTTPS
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
return 301 https://$host$request_uri;
# HTTPS - proxy requests to /parse-server/
# through to Parse Server
server {
View gist:6d5bc1ad8f380f0c72b593808ed9d576
Write a function that pluralizes words.
• By default, it just adds "s" to the end.
• But there are some exceptions ("goose" -> "geese")
• Create a dictionary of exceptions, so I can look up "hoof" and get back "hooves".
• The function should first check the dictionary, to see if it has an exception, then fall back to appending "s"