Skip to content

Instantly share code, notes, and snippets.

- (NSArray *)gitCommands {
return @[@{Command: @"git status", Reference: @": shows changed files"},
@{Command: @"git diff", Reference: @": shows actual changes"},
@{Command: @"git add .", Reference: @": adds changed files to the commit"},
@{Command: @"git commit -m \"notes\"", Reference: @": commits the changes"},
@{Command: @"git push origin _branch_", Reference: @": pushes commits to branch named _branch_"},
@{Command: @"git log", Reference: @": displays progress log"},
@{Command: @"git comment --amend", Reference: @": re-enter last commit message"}
@jkhowland
jkhowland / gist:89e24b5fb6e1b5048eb5
Last active August 29, 2015 14:02
Creating a task controller singleton for a task controller
// This goes in the header file
+ (EntryController *)sharedInstance;
// This goes in the implementation file
+ (EntryController *)sharedInstance {
static EntryController *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[EntryController alloc] init];
- (NSArray *)data {
return @[
[self fruits],
[self liquids],
[self desserts]
];
}
@jkhowland
jkhowland / gist:715845b34014aa7f54ef
Last active August 29, 2015 14:02
Code to check if tic tac toe game has been won
// See tic tac toe by Lenli https://github.com/lenli/tictactoe
-(BOOL)isGameOver {
NSArray *winCombinations = [[NSArray alloc] initWithObjects: @[@1,@2,@3], @[@4,@5,@6], @[@7,@8,@9],
@[@1,@4,@7], @[@2,@5,@8], @[@3,@6,@9],
@[@1,@5,@9], @[@3,@5,@7], nil];
for (NSArray *winCombination in winCombinations) {
BOOL isWinner = TRUE;
for (NSNumber *winIndex in winCombination) {
@jkhowland
jkhowland / Stack.h
Last active March 31, 2020 13:43
Simple Core Data - Stack.m
//
// Stack.m
//
// Created by Joshua Howland on 6/12/14.
// Copyright (c) 2014 DevMountain. All rights reserved.
//
#import <Foundation/Foundation.h>
@import CoreData;
@jkhowland
jkhowland / Data Functions
Created August 10, 2014 16:44
GitReference - Data Methods - Swift
func gitCommands() -> Array<[String: String]> {
var commands = [[String: String]]()
commands.append([Command: "git status", Reference: ": shows changed files"])
commands.append([Command: "git diff", Reference: ": shows actual changes"])
commands.append([Command: "git add .", Reference: ": adds changed files to the commit"])
commands.append([Command: "git commit -m \"notes\"", Reference: ": commits the changes"])
commands.append([Command: "git push origin _branch_", Reference: ": pushes commits to branch named _branch_"])
commands.append([Command: "git log", Reference: ": displays progress log"])
@jkhowland
jkhowland / Data Methods
Last active August 29, 2015 14:05
GitReference - Data Methods - Objective-C
static CGFloat margin = 15;
static NSString * const Command = @"command";
static NSString * const Reference = @"reference";
- (NSArray *)gitCommands {
return @[@{Command: @"git status", Reference: @": shows changed files"},
@{Command: @"git diff", Reference: @": shows actual changes"},
@{Command: @"git add .", Reference: @": adds changed files to the commit"},
@jkhowland
jkhowland / RARecipes.h
Last active August 29, 2015 14:05
RARecipes Model Files
//
// RARecipes.h
// Recipe App
//
// Created by Joshua Howland on 5/22/14.
// Copyright (c) 2014 DevMountain. All rights reserved.
//
#import <Foundation/Foundation.h>
@jkhowland
jkhowland / TakeSaveAccessPhotos
Created January 30, 2015 07:16
OnTheLine-TakeSaveAccessPhotos
- (void)savePhoto:(UIImage *)photo completion:(void (^)(void))completion {
CGSize scaledSize = CGSizeMake(512, 512);
if (photo.size.width > photo.size.height) {
CGFloat ratio = photo.size.height / photo.size.width;
scaledSize.height = round(scaledSize.width * ratio);
} else {
CGFloat ratio = photo.size.width / photo.size.height;
scaledSize.width = round(scaledSize.height * ratio);
@jkhowland
jkhowland / TableViewDataSourceMethods
Created January 30, 2015 07:17
OnTheLine-TableViewDataSource
- (IBAction)takePhoto:(id)sender {
self.photoCount++;
[self.tableView reloadData];
}
#pragma mark - Table view data source
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
PhotoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PhotoCell"];