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 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;
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"
View gist:f62bb45c141048833bed314d930ef472
public extension UIDevice {
var deviceType: String {
var systemInfo = utsname()
let machine = systemInfo.machine
let mirror = Mirror(reflecting: machine)
var identifier = ""
View gist:476e9a2ea9155c3c4157c5c8dcd2b43f
import Vapor
let drop = Droplet()
drop.get("welcome") { request in
return "Hello"
drop.get("uppercase") { request in
guard let word =["word"]?.string else { return "Could not grab the name" }